Exemplo n.º 1
0
 /**
  * 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.
  */
 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);
             }
         }
     }
 }
 function registerActiveExtensions()
 {
     $this->registerExtensions($this->system->getActiveExtensions());
 }