Modules/Manager: did we load all enabled modules?

This commit is contained in:
Thomas Gelf 2015-11-12 17:14:23 +01:00
parent f9a0e7dec6
commit a1832e1424

View File

@ -73,6 +73,13 @@ class Manager
*/ */
private $modulePaths = array(); private $modulePaths = array();
/**
* Whether we loaded all enabled modules
*
* @var bool
*/
private $loadedAllEnabledModules = false;
/** /**
* Create a new instance of the module manager * Create a new instance of the module manager
* *
@ -177,12 +184,28 @@ class Manager
*/ */
public function loadEnabledModules() public function loadEnabledModules()
{ {
foreach ($this->listEnabledModules() as $name) { if (! $this->loadedAllEnabledModules) {
$this->loadModule($name); foreach ($this->listEnabledModules() as $name) {
$this->loadModule($name);
}
$this->loadedAllEnabledModules = true;
} }
return $this; return $this;
} }
/**
* Whether we loaded all enabled modules
*
* @return bool
*/
public function loadedAllEnabledModules()
{
return $this->loadedAllEnabledModules;
}
/** /**
* Try to load the module and register it in the application * Try to load the module and register it in the application
* *
@ -245,6 +268,8 @@ class Manager
); );
} }
$this->loadedAllEnabledModules = false;
if (file_exists($link) && is_link($link)) { if (file_exists($link) && is_link($link)) {
return $this; return $this;
} }