add --disable-plugins option for server command

This commit is contained in:
crazywhalecc 2023-02-20 23:39:38 +08:00 committed by Jerry
parent 00da7d14fb
commit eb288f7e51
2 changed files with 7 additions and 1 deletions

View File

@ -37,6 +37,7 @@ class ServerStartCommand extends ServerCommand
new InputOption('no-state-check', null, null, '关闭启动前框架运行状态检查'),
new InputOption('private-mode', null, null, '启动时隐藏MOTD和敏感信息'),
new InputOption('print-process-pid', null, null, '打印所有进程的PID'),
new InputOption('disable-plugins', null, InputOption::VALUE_REQUIRED, '要禁用的插件,如需多个,采用逗号分割名称'),
]);
$this->setHelp('直接运行可以启动');
}

View File

@ -227,9 +227,14 @@ class WorkerEventListener
logger()->info('已加载 ' . $count . ' 个 Composer 插件');
}
}
$disable_list = Framework::getInstance()->getArgv()['disable-plugins'];
if ($disable_list === null) {
$disable_list = '';
}
$exp = explode(',', $disable_list);
// 启用并初始化插件
PluginManager::enablePlugins($parser);
PluginManager::enablePlugins($parser, $exp);
}
// 解析所有注册路径的文件,获取注解