function UpdateRegistry::getPendingUpdateInformation

Same name in other branches
  1. 9 core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::getPendingUpdateInformation()
  2. 8.9.x core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::getPendingUpdateInformation()
  3. 11.x core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::getPendingUpdateInformation()

Returns a list of all the pending updates.

Return value

array[] An associative array keyed by extension name which contains all information about database updates that need to be run, and any updates that are not going to proceed due to missing requirements.

The subarray for each extension can contain the following keys:

  • start: The starting update that is to be processed. If this does not exist then do not process any updates for this extension as there are other requirements that need to be resolved.
  • pending: An array of all the pending updates for the extension including the description from source code comment for each update function. This array is keyed by the update name.

File

core/lib/Drupal/Core/Update/UpdateRegistry.php, line 230

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

public function getPendingUpdateInformation() {
    $functions = $this->getPendingUpdateFunctions();
    $ret = [];
    foreach ($functions as $function) {
        [
            $extension,
            $update,
        ] = explode("_{$this->updateType}_", $function);
        // The description for an update comes from its Doxygen.
        $func = new \ReflectionFunction($function);
        $description = trim(str_replace([
            "\n",
            '*',
            '/',
        ], '', $func->getDocComment()), ' ');
        $ret[$extension]['pending'][$update] = $description;
        if (!isset($ret[$extension]['start'])) {
            $ret[$extension]['start'] = $update;
        }
    }
    return $ret;
}

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