mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-11 09:48:40 +00:00
Use dynamic module path
This commit is contained in:
parent
e4ec4b2ae2
commit
0f19264e86
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user