function UpdateHookRegistry::determineModuleAndVersion
Determines the module and update number from the stack trace.
Return value
array<string, int> An array with two values. The first value is the module name and the second value is the update number.
2 calls to UpdateHookRegistry::determineModuleAndVersion()
- UpdateHookRegistry::getEquivalentUpdate in core/
lib/ Drupal/ Core/ Update/ UpdateHookRegistry.php  - Gets the EquivalentUpdate object for an update.
 - UpdateHookRegistry::markFutureUpdateEquivalent in core/
lib/ Drupal/ Core/ Update/ UpdateHookRegistry.php  - Marks a future update as equivalent to the current update running.
 
File
- 
              core/
lib/ Drupal/ Core/ Update/ UpdateHookRegistry.php, line 267  
Class
- UpdateHookRegistry
 - Provides module updates versions handling.
 
Namespace
Drupal\Core\UpdateCode
private function determineModuleAndVersion() : array {
  $stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  for ($i = 0; $i < count($stack); $i++) {
    if (preg_match(self::FUNC_NAME_REGEXP, $stack[$i]['function'], $matches)) {
      return [
        $matches['module'],
        $matches['version'],
      ];
    }
  }
  throw new \BadMethodCallException(__METHOD__ . ' must be called from a hook_update_N() function');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.