function UpdateRegistry::getUpdateFunctions

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

Returns all available updates for a given extension.

Parameters

string $extension_name: The extension name.

Return value

callable[] A list of update functions.

1 call to UpdateRegistry::getUpdateFunctions()
UpdateRegistry::onConfigSave in core/lib/Drupal/Core/Update/UpdateRegistry.php
Processes the list of installed extensions when core.extension changes.

File

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

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

public function getUpdateFunctions($extension_name) {
    $this->scanExtensionsAndLoadUpdateFiles($extension_name);
    $updates = [];
    $functions = get_defined_functions();
    foreach (preg_grep('/^' . $extension_name . '_' . $this->updateType . '_/', $functions['user']) as $function) {
        $updates[] = $function;
    }
    // Ensure that the update order is deterministic.
    sort($updates);
    return $updates;
}

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