From 0f19264e864c0e7b754734607c84a5cb6df3a61f Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sat, 1 Apr 2017 13:58:19 +0200 Subject: [PATCH] Use dynamic module path --- Module/ModuleManager.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Module/ModuleManager.php b/Module/ModuleManager.php index 6dc924b4c..f3546a17c 100644 --- a/Module/ModuleManager.php +++ b/Module/ModuleManager.php @@ -71,13 +71,15 @@ class ModuleManager */ private $active = null; + private $modulePath = __DIR__ . '/../../Modules'; + /** * All modules in the module directory. * * @var array * @since 1.0.0 */ - private static $all = null; + private $all = null; /** * To load based on request uri. @@ -98,7 +100,7 @@ class ModuleManager public function __construct(ApplicationAbstract $app, string $modulePath = '') { $this->app = $app; - $modulePath = $modulePath; + $this->modulePath = $modulePath; } /** @@ -232,9 +234,9 @@ class ModuleManager * @since 1.0.0 * @author Dennis Eichhorn */ - public static function getAllModules() : array + public function getAllModules() : array { - if (!isset(self::$all)) { + if (!isset($this->all)) { chdir($this->modulePath); $files = glob('*', GLOB_ONLYDIR); $c = count($files); @@ -248,11 +250,11 @@ class ModuleManager } $json = json_decode(file_get_contents($path), true); - self::$all[$json['name']['internal']] = $json; + $this->all[$json['name']['internal']] = $json; } } - return self::$all; + return $this->all; } /**