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
1 changed files with 27 additions and 2 deletions

View File

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