This commit is contained in:
Default
2025-03-23 19:02:52 +08:00
parent 4c4afd37ed
commit 1f5572a1af
14 changed files with 66 additions and 1021 deletions

View File

@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace ddl;
class DDLManage
{
private static $arrLoadedModules = [];
private static $arrModuleFiles = [
'MicroServer' => 'extend/ddl/MicroCore.ddl',
'MongoBase' => 'extend/ddl/MongoBase.ddl',
'DatabaseManage' => 'extend/ddl/DatabaseManage.ddl',
];
/**
* 加载指定模块
* @param string $strModuleCode 模块编码
* @return bool 加载是否成功
*/
public static function load($strModuleCode)
{
if (isset(self::$arrLoadedModules[$strModuleCode])) {
return true;
}
if (!isset(self::$arrModuleFiles[$strModuleCode])) {
return false;
}
$filename = self::$arrModuleFiles[$strModuleCode];
$strFileName = root_path() . $filename;
if (!file_exists($strFileName)) {
return false;
}
if (load_module_file($strFileName)) {
self::$arrLoadedModules[$strModuleCode] = true;
return true;
} else {
return false;
}
}
/**
* 检查模块是否已加载
* @param string $strModuleCode 类名
* @return bool
*/
public static function isLoaded($strModuleCode)
{
return isset(self::$arrLoadedModules[$strModuleCode]);
}
/**
* 获取所有已加载的模块
* @return array
*/
public static function getarrLoadedModules()
{
return array_keys(self::$arrLoadedModules);
}
}

Binary file not shown.

Binary file not shown.

Binary file not shown.