mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-08 12:58:11 +08:00
fix: 去除 blob 使用
This commit is contained in:
parent
9c6b1c430e
commit
836d327971
@ -18,6 +18,8 @@ declare (strict_types=1);
|
||||
|
||||
namespace think\admin;
|
||||
|
||||
use SplFileInfo;
|
||||
use think\admin\extend\ToolsExtend;
|
||||
use think\admin\service\RuntimeService;
|
||||
use think\admin\support\command\Database;
|
||||
use think\admin\support\command\Package;
|
||||
@ -106,7 +108,9 @@ class Library extends Service
|
||||
{
|
||||
// 动态加载全局配置
|
||||
[$dir, $ext] = [$this->app->getBasePath(), $this->app->getConfigExt()];
|
||||
foreach (glob("{$dir}*/sys{$ext}") as $file) include_once $file;
|
||||
ToolsExtend::findFilesYield($dir, static function (SplFileInfo $info) use ($ext) {
|
||||
$info->getBasename() === "sys{$ext}" && include_once $info->getPathname();
|
||||
});
|
||||
if (is_file($file = "{$dir}common{$ext}")) include_once $file;
|
||||
if (is_file($file = "{$dir}provider{$ext}")) $this->app->bind(include $file);
|
||||
if (is_file($file = "{$dir}event{$ext}")) $this->app->loadEvent(include $file);
|
||||
|
||||
@ -20,6 +20,7 @@ namespace think\admin\extend;
|
||||
|
||||
use Exception;
|
||||
use Phinx\Db\Adapter\AdapterInterface;
|
||||
use SplFileInfo;
|
||||
use think\admin\Library;
|
||||
use think\admin\model\SystemMenu;
|
||||
use think\admin\service\ProcessService;
|
||||
@ -290,20 +291,22 @@ CODE;
|
||||
*/
|
||||
private static function nextFile(string $class): string
|
||||
{
|
||||
[$filename, $versions, $start] = [Str::snake($class), [], 20009999999999];
|
||||
if (count($files = glob(syspath('database/migrations/*.php'))) > 0) {
|
||||
foreach ($files as $file) {
|
||||
$versions[] = $version = intval(substr($bname = pathinfo($file, 8), 0, 14));
|
||||
if ($filename === substr($bname, 15) && unlink($file)) {
|
||||
echo " ** Notify: Class {$class} already exists and has been replaced." . PHP_EOL;
|
||||
if (is_dir($dataPath = dirname($file) . DIRECTORY_SEPARATOR . $version)) {
|
||||
ToolsExtend::removeEmptyDirectory($dataPath);
|
||||
}
|
||||
[$filename, $versions, $startVersion] = [Str::snake($class), [], 20009999999999];
|
||||
ToolsExtend::findFilesYield(syspath('database/migrations'), static 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())) {
|
||||
echo " ** Notify: Class {$class} already exists and has been replaced." . PHP_EOL;
|
||||
if (is_dir($dataPath = dirname($info->getRealPath()) . DIRECTORY_SEPARATOR . $version)) {
|
||||
ToolsExtend::removeEmptyDirectory($dataPath);
|
||||
}
|
||||
}
|
||||
$version = min($versions) - 1;
|
||||
}
|
||||
if (!isset($version) || $version > $start) $version = $start;
|
||||
});
|
||||
|
||||
// 计算下一个版本号
|
||||
$version = !empty($versions) ? min($versions) - 1 : $startVersion;
|
||||
$version = min($version, $startVersion);
|
||||
|
||||
return "{$version}_{$filename}.php";
|
||||
}
|
||||
}
|
||||
@ -19,6 +19,8 @@ declare (strict_types=1);
|
||||
namespace think\admin\support\middleware;
|
||||
|
||||
use Closure;
|
||||
use SplFileInfo;
|
||||
use think\admin\extend\ToolsExtend;
|
||||
use think\admin\Plugin;
|
||||
use think\admin\service\NodeService;
|
||||
use think\admin\service\SystemService;
|
||||
@ -165,9 +167,11 @@ class MultAccess
|
||||
{
|
||||
[$ext, $fmaps] = [$this->app->getConfigExt(), []];
|
||||
if (is_file($file = "{$appPath}common{$ext}")) include_once $file;
|
||||
foreach (glob($appPath . 'config' . DIRECTORY_SEPARATOR . '*' . $ext) as $file) {
|
||||
$this->app->config->load($file, $fmaps[] = pathinfo($file, PATHINFO_FILENAME));
|
||||
}
|
||||
ToolsExtend::findFilesYield($appPath . 'config', static 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();
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user