activane module fix
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
namespace kernel\services;
|
||||
|
||||
use DirectoryIterator;
|
||||
use kernel\helpers\Debug;
|
||||
use kernel\helpers\Manifest;
|
||||
use kernel\models\Option;
|
||||
@ -51,4 +52,24 @@ class ModuleService
|
||||
$active_modules->save();
|
||||
}
|
||||
|
||||
public function getModuleDir(string $slug)
|
||||
{
|
||||
$module_paths = Option::where("key", "module_paths")->first();
|
||||
$dirs = [];
|
||||
if ($module_paths){
|
||||
$path = json_decode($module_paths->value);
|
||||
foreach ($path->paths as $p){
|
||||
$dirs[] = getConst($p);
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($dirs as $dir){
|
||||
foreach (new DirectoryIterator($dir) as $fileInfo) {
|
||||
if(basename($fileInfo->getPathname()) !== $slug) continue;
|
||||
return $fileInfo->getPathname();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user