asdasd
This commit is contained in:
@@ -25,7 +25,21 @@ final class App
|
|||||||
$this->flash = new Flash($this->session);
|
$this->flash = new Flash($this->session);
|
||||||
$this->pdo = Database::createPdo($config);
|
$this->pdo = Database::createPdo($config);
|
||||||
$this->basePdo = Database::createBasePdo($config);
|
$this->basePdo = Database::createBasePdo($config);
|
||||||
$this->modules = new ModuleManager($this->basePdo, __DIR__ . '/../../modules');
|
$modulesPath = $this->config->modulesPath;
|
||||||
|
if ($modulesPath === '' || !is_dir($modulesPath)) {
|
||||||
|
$candidates = [
|
||||||
|
__DIR__ . '/../../modules',
|
||||||
|
__DIR__ . '/../modules',
|
||||||
|
dirname(__DIR__, 3) . '/modules',
|
||||||
|
];
|
||||||
|
foreach ($candidates as $candidate) {
|
||||||
|
if (is_dir($candidate)) {
|
||||||
|
$modulesPath = $candidate;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->modules = new ModuleManager($this->basePdo, $modulesPath);
|
||||||
$this->modules->bootEnabled();
|
$this->modules->bootEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class Config
|
|||||||
public string $oidcGroupClaim;
|
public string $oidcGroupClaim;
|
||||||
public string $oidcAdminGroup;
|
public string $oidcAdminGroup;
|
||||||
public string $oidcUserGroup;
|
public string $oidcUserGroup;
|
||||||
|
public string $modulesPath;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public array $db,
|
public array $db,
|
||||||
@@ -52,6 +53,7 @@ class Config
|
|||||||
$this->oidcGroupClaim = defined('APP_OIDC_GROUP_CLAIM') ? (string)APP_OIDC_GROUP_CLAIM : 'groups';
|
$this->oidcGroupClaim = defined('APP_OIDC_GROUP_CLAIM') ? (string)APP_OIDC_GROUP_CLAIM : 'groups';
|
||||||
$this->oidcAdminGroup = defined('APP_OIDC_ADMIN_GROUP') ? (string)APP_OIDC_ADMIN_GROUP : 'admin';
|
$this->oidcAdminGroup = defined('APP_OIDC_ADMIN_GROUP') ? (string)APP_OIDC_ADMIN_GROUP : 'admin';
|
||||||
$this->oidcUserGroup = defined('APP_OIDC_USER_GROUP') ? (string)APP_OIDC_USER_GROUP : 'user';
|
$this->oidcUserGroup = defined('APP_OIDC_USER_GROUP') ? (string)APP_OIDC_USER_GROUP : 'user';
|
||||||
|
$this->modulesPath = defined('APP_MODULES_PATH') ? (string)APP_MODULES_PATH : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function primaryUrl(): string
|
public function primaryUrl(): string
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ final class ModuleManager
|
|||||||
{
|
{
|
||||||
$this->modules = [];
|
$this->modules = [];
|
||||||
if (!is_dir($this->modulesPath)) {
|
if (!is_dir($this->modulesPath)) {
|
||||||
|
if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL) {
|
||||||
|
@file_put_contents(__DIR__ . '/../../debug/module_scan.log', 'Modules path not found: ' . $this->modulesPath . PHP_EOL, FILE_APPEND);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -218,6 +221,10 @@ final class ModuleManager
|
|||||||
$module['enabled'] = $this->loadEnabledState($name, $module);
|
$module['enabled'] = $this->loadEnabledState($name, $module);
|
||||||
$this->modules[$name] = $module;
|
$this->modules[$name] = $module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL) {
|
||||||
|
@file_put_contents(__DIR__ . '/../../debug/module_scan.log', 'Modules loaded: ' . implode(', ', array_keys($this->modules)) . PHP_EOL, FILE_APPEND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadEnabledState(string $name, array $module): bool
|
private function loadEnabledState(string $name, array $module): bool
|
||||||
|
|||||||
Reference in New Issue
Block a user