public function DrupalPhaseControl::checkNewExtensions in X Autoload 7.5
Checks if new extensions have been enabled, and registers them.
This is called from xautoload_module_implements_alter(), which is called whenever a new module is enabled, but also some calls we need to ignore.
File
- src/
Phases/ DrupalPhaseControl.php, line 128
Class
- DrupalPhaseControl
- Records events during a Drupal request, and forwards them to the registered observers after the first class loader cache miss.
Namespace
Drupal\xautoload\PhasesCode
public function checkNewExtensions() {
if (!$this->awake) {
// The entire thing is not initialized yet.
// Postpone until operateOnFinder()
return;
}
$activeExtensions = $this->system
->getActiveExtensions();
if ($activeExtensions === $this->extensions) {
// Nothing actually changed. False alarm.
return;
}
// Now check all extensions to find out if any of them is new.
foreach ($activeExtensions as $name => $type) {
if (!isset($this->extensions[$name])) {
// This extension was freshly enabled.
if ('xautoload' === $name) {
// If xautoload is enabled in this request, then boot phase and main
// phase are not properly initialized yet.
$this
->enterMainPhase();
}
// Notify observers about the new extension.
foreach ($this->observers as $observer) {
$observer
->welcomeNewExtension($name, $type);
}
}
}
}