function Database::commitAllOnShutdown

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Database/Database.php \Drupal\Core\Database\Database::commitAllOnShutdown()

Calls commitAll() on all the open connections.

If drupal_register_shutdown_function() exists the commit will occur during shutdown so that it occurs at the latest possible moment.

@internal This method exists only to work around a bug caused by Drupal incorrectly relying on object destruction order to commit transactions. Xdebug 3.3.0 changes the order of object destruction when the develop mode is enabled.

Parameters

bool $shutdown: Internal param to denote that the method is being called by _drupal_shutdown_function().

Return value

void

1 call to Database::commitAllOnShutdown()
Transaction::__construct in core/lib/Drupal/Core/Database/Transaction.php

File

core/lib/Drupal/Core/Database/Database.php, line 769

Class

Database
Primary front-controller for the database system.

Namespace

Drupal\Core\Database

Code

public static function commitAllOnShutdown(bool $shutdown = FALSE) : void {
    static $registered = FALSE;
    if ($shutdown) {
        foreach (self::$connections as $targets) {
            foreach ($targets as $connection) {
                if ($connection instanceof Connection) {
                    $connection->commitAll();
                }
            }
        }
        return;
    }
    if (!function_exists('drupal_register_shutdown_function')) {
        return;
    }
    if (!$registered) {
        $registered = TRUE;
        drupal_register_shutdown_function('\\Drupal\\Core\\Database\\Database::commitAllOnShutdown', TRUE);
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.