mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-08 04:48:10 +08:00
fix: 应用文件加载及注释
This commit is contained in:
parent
a2e7318104
commit
7497620aeb
@ -108,7 +108,7 @@ class Library extends Service
|
||||
{
|
||||
// 动态加载全局配置
|
||||
[$dir, $ext] = [$this->app->getBasePath(), $this->app->getConfigExt()];
|
||||
ToolsExtend::findFilesYield($dir, static function (SplFileInfo $info) use ($ext) {
|
||||
ToolsExtend::findFilesYield($dir, function (SplFileInfo $info) use ($ext) {
|
||||
$info->getBasename() === "sys{$ext}" && include_once $info->getPathname();
|
||||
});
|
||||
if (is_file($file = "{$dir}common{$ext}")) include_once $file;
|
||||
|
||||
@ -292,7 +292,7 @@ CODE;
|
||||
private static function nextFile(string $class): string
|
||||
{
|
||||
[$filename, $versions, $startVersion] = [Str::snake($class), [], 20009999999999];
|
||||
ToolsExtend::findFilesYield(syspath('database/migrations'), static function (SplFileInfo $info) use ($class, $filename, &$versions) {
|
||||
ToolsExtend::findFilesYield(syspath('database/migrations'), function (SplFileInfo $info) use ($class, $filename, &$versions) {
|
||||
$bname = pathinfo($info->getBasename(), PATHINFO_FILENAME);
|
||||
$versions[] = $version = intval(substr($bname, 0, 14));
|
||||
if ($filename === substr($bname, 15) && unlink($info->getRealPath())) {
|
||||
|
||||
@ -166,21 +166,27 @@ class MultAccess
|
||||
private function loadMultiApp(string $appPath): bool
|
||||
{
|
||||
[$ext, $fmaps] = [$this->app->getConfigExt(), []];
|
||||
// 加载应用函数文件
|
||||
if (is_file($file = "{$appPath}common{$ext}")) include_once $file;
|
||||
ToolsExtend::findFilesYield($appPath . 'config', static function (SplFileInfo $info) use ($ext) {
|
||||
if (strtolower(".{$info->getExtension()}") === "{$ext}") {
|
||||
// 加载应用配置文件
|
||||
ToolsExtend::findFilesYield($appPath . 'config', function (SplFileInfo $info) use ($ext) {
|
||||
if (strtolower(".{$info->getExtension()}") === $ext) {
|
||||
$this->app->config->load($info->getPathname(), $info->getBasename($ext));
|
||||
}
|
||||
});
|
||||
// 加载应用路由配置
|
||||
if (in_array('route', $fmaps) && method_exists($this->app->route, 'reload')) {
|
||||
$this->app->route->reload();
|
||||
}
|
||||
// 加载应用映射配置
|
||||
if (is_file($file = "{$appPath}provider{$ext}")) {
|
||||
$this->app->bind(include $file);
|
||||
}
|
||||
// 加载应用事件配置
|
||||
if (is_file($file = "{$appPath}event{$ext}")) {
|
||||
$this->app->loadEvent(include $file);
|
||||
}
|
||||
// 加载应用中间键配置
|
||||
if (is_file($file = "{$appPath}middleware{$ext}")) {
|
||||
$this->app->middleware->import(include $file, 'app');
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user