mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-21 15:45:36 +08:00
add composer module support (build 449, 2.7.2)
This commit is contained in:
@@ -165,9 +165,6 @@ class OnWorkerStart implements SwooleEvent
|
||||
if (trim($k, '\\') == 'ZM') {
|
||||
continue;
|
||||
}
|
||||
if (\server()->worker_id == 0) {
|
||||
Console::verbose('Add ' . $v . ":{$k} to register path");
|
||||
}
|
||||
$parser->addRegisterPath(DataProvider::getSourceRootDir() . '/' . $v . '/', trim($k, '\\'));
|
||||
}
|
||||
}
|
||||
@@ -187,6 +184,15 @@ class OnWorkerStart implements SwooleEvent
|
||||
}
|
||||
}
|
||||
|
||||
// 检查所有的Composer模块,并加载注解
|
||||
$list = ModuleManager::getComposerModules();
|
||||
foreach ($list as $k => $v) {
|
||||
if (\server()->worker_id === 0) {
|
||||
Console::info('Loading composer module: ' . $k);
|
||||
}
|
||||
$parser->addRegisterPath($v['module-path'], $v['namespace']);
|
||||
}
|
||||
|
||||
$parser->registerMods();
|
||||
EventManager::loadEventByParser($parser); // 加载事件
|
||||
|
||||
|
||||
Reference in New Issue
Block a user