diff --git a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php index 4b2dce5..dd82606 100644 --- a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php @@ -17,17 +17,37 @@ */ class UpdateModuleHandler extends ModuleHandler { + /** + * Whether hook invocations are locked down to an explicit whitelist. + * + * @var bool + */ protected $locked = FALSE; + /** + * Returns whether hook invocations are locked down to an explicit whitelist. + * + * @return bool + */ public function isLocked() { return $this->locked; } + /** + * Locks down hook invocations to an explicit whitelist. + * + * Called right before update functions are executed. + */ public function lock() { $this->locked = TRUE; return $this; } + /** + * Unlocks hook invocations. + * + * Called after update functions have been executed. + */ public function unlock() { $this->locked = FALSE; return $this; @@ -37,9 +57,11 @@ public function unlock() { * {@inheritdoc} */ public function getImplementations($hook) { - if (!$this->isLocked) { + // If not running update functions, all hooks can be invoked. + if (!$this->isLocked()) { return parent::getImplementations($hook); } + if (substr($hook, -6) === '_alter') { return array(); } diff --git a/core/update.php b/core/update.php index 106a135..9600d3d 100644 --- a/core/update.php +++ b/core/update.php @@ -444,7 +444,9 @@ function update_task_list($active = NULL) { // Regular batch ops : defer to batch processing API. default: update_task_list('run'); + \Drupal::moduleHandler()->lock(); $output = _batch_page($request); + \Drupal::moduleHandler()->unlock(); break; } }