UpdateRegistry::getAvailableUpdateFunctions

protected UpdateRegistry::getAvailableUpdateFunctions()

Gets all available update functions.

Return value

callable[] A list of update functions.

File

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

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
protected function getAvailableUpdateFunctions() {
  $regexp = '/^(?<module>.+)_' . $this->updateType . '_(?<name>.+)$/';
  $functions = get_defined_functions();
 
  $updates = [];
  foreach (preg_grep('/_' . $this->updateType . '_/', $functions['user']) as $function) {
    // If this function is a module update function, add it to the list of
    // module updates.
    if (preg_match($regexp, $function, $matches)) {
      if (in_array($matches['module'], $this->enabledModules)) {
        $updates[] = $matches['module'] . '_' . $this->updateType . '_' . $matches['name'];
      }
    }
  }
 
  // Ensure that the update order is deterministic.
  sort($updates);
  return $updates;
}
doc_Drupal
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.