activane module fix
This commit is contained in:
parent
fc80a63a6d
commit
456d5afec3
@ -53,7 +53,7 @@ class ModuleController extends AdminController
|
||||
$request = new Request();
|
||||
$this->moduleService->setActiveModule($request->get("slug"));
|
||||
|
||||
$this->cgView->render("view.php", ['data' => $this->moduleService->getModuleInfo(KERNEL_MODULES_DIR . '/' . $request->get("slug"))]);
|
||||
$this->cgView->render("view.php", ['data' => $this->moduleService->getModuleInfo($this->moduleService->getModuleDir($request->get("slug")))]);
|
||||
}
|
||||
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user