From d07cc95740b5a6e41d3b5150a6a5912587e055eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=AF=E7=AB=8B?= Date: Tue, 18 May 2021 14:32:53 +0800 Subject: [PATCH] ComposerUpdate --- vendor/composer/autoload_classmap.php | 1 - vendor/composer/autoload_static.php | 1 - vendor/composer/installed.json | 8 +- vendor/services.php | 2 +- .../zoujingli/think-library/src/Command.php | 2 + .../think-library/src/Controller.php | 1 - vendor/zoujingli/think-library/src/Helper.php | 2 +- .../zoujingli/think-library/src/Library.php | 7 +- vendor/zoujingli/think-library/src/Queue.php | 40 +++++--- .../zoujingli/think-library/src/Storage.php | 3 +- .../think-library/src/command/Database.php | 12 +-- .../think-library/src/command/Install.php | 1 - .../think-library/src/command/Replace.php | 14 +-- .../think-library/src/helper/TokenHelper.php | 2 +- .../think-library/src/multiple/BuildUrl.php | 6 -- .../think-library/src/multiple/Multiple.php | 49 ++++----- .../src/multiple/command/Clear.php | 99 ------------------- .../think-library/src/service/NodeService.php | 7 +- .../src/service/ProcessService.php | 12 ++- .../src/service/SystemService.php | 11 ++- 20 files changed, 89 insertions(+), 191 deletions(-) delete mode 100644 vendor/zoujingli/think-library/src/multiple/command/Clear.php diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 0ffdef6c2..77cc8e013 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -337,7 +337,6 @@ return array( 'think\\admin\\multiple\\BuildUrl' => $vendorDir . '/zoujingli/think-library/src/multiple/BuildUrl.php', 'think\\admin\\multiple\\Multiple' => $vendorDir . '/zoujingli/think-library/src/multiple/Multiple.php', 'think\\admin\\multiple\\command\\Build' => $vendorDir . '/zoujingli/think-library/src/multiple/command/Build.php', - 'think\\admin\\multiple\\command\\Clear' => $vendorDir . '/zoujingli/think-library/src/multiple/command/Clear.php', 'think\\admin\\service\\AdminService' => $vendorDir . '/zoujingli/think-library/src/service/AdminService.php', 'think\\admin\\service\\CaptchaService' => $vendorDir . '/zoujingli/think-library/src/service/CaptchaService.php', 'think\\admin\\service\\ExpressService' => $vendorDir . '/zoujingli/think-library/src/service/ExpressService.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 34a4d2f73..a083294b0 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -466,7 +466,6 @@ class ComposerStaticInit0ec6378467f464339c264d61cf644c03 'think\\admin\\multiple\\BuildUrl' => __DIR__ . '/..' . '/zoujingli/think-library/src/multiple/BuildUrl.php', 'think\\admin\\multiple\\Multiple' => __DIR__ . '/..' . '/zoujingli/think-library/src/multiple/Multiple.php', 'think\\admin\\multiple\\command\\Build' => __DIR__ . '/..' . '/zoujingli/think-library/src/multiple/command/Build.php', - 'think\\admin\\multiple\\command\\Clear' => __DIR__ . '/..' . '/zoujingli/think-library/src/multiple/command/Clear.php', 'think\\admin\\service\\AdminService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/AdminService.php', 'think\\admin\\service\\CaptchaService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/CaptchaService.php', 'think\\admin\\service\\ExpressService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ExpressService.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index d347b4271..a97ad640d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -834,12 +834,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "72156b3cbcccb0be17fc6706de094e9f12a20f74" + "reference": "e2c63ede57564e638e54bbca483d307b639b114a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/72156b3cbcccb0be17fc6706de094e9f12a20f74", - "reference": "72156b3cbcccb0be17fc6706de094e9f12a20f74", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e2c63ede57564e638e54bbca483d307b639b114a", + "reference": "e2c63ede57564e638e54bbca483d307b639b114a", "shasum": "", "mirrors": [ { @@ -856,7 +856,7 @@ "ext-mbstring": "*", "topthink/framework": "^6.0" }, - "time": "2021-05-17T11:05:01+00:00", + "time": "2021-05-18T06:14:56+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/services.php b/vendor/services.php index 07a59f696..416620773 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\admin\\Library', diff --git a/vendor/zoujingli/think-library/src/Command.php b/vendor/zoujingli/think-library/src/Command.php index 8bb249f1c..dc3a72ddd 100644 --- a/vendor/zoujingli/think-library/src/Command.php +++ b/vendor/zoujingli/think-library/src/Command.php @@ -81,6 +81,7 @@ abstract class Command extends \think\console\Command $this->queue->error($message); } elseif (is_string($message)) { $this->output->writeln($message); + exit("\r\n"); } return $this; } @@ -97,6 +98,7 @@ abstract class Command extends \think\console\Command $this->queue->success($message); } elseif (is_string($message)) { $this->output->writeln($message); + exit("\r\n"); } return $this; } diff --git a/vendor/zoujingli/think-library/src/Controller.php b/vendor/zoujingli/think-library/src/Controller.php index f2b88dd34..f815f80dd 100644 --- a/vendor/zoujingli/think-library/src/Controller.php +++ b/vendor/zoujingli/think-library/src/Controller.php @@ -78,7 +78,6 @@ abstract class Controller extends stdClass if (in_array($this->request->action(), get_class_methods(__CLASS__))) { $this->error('Access without permission.'); } - $this->csrf_message = lang('think_library_csrf_error'); $this->initialize(); } diff --git a/vendor/zoujingli/think-library/src/Helper.php b/vendor/zoujingli/think-library/src/Helper.php index 21c7051f8..ca368fda0 100644 --- a/vendor/zoujingli/think-library/src/Helper.php +++ b/vendor/zoujingli/think-library/src/Helper.php @@ -60,7 +60,7 @@ abstract class Helper /** * 获取数据库对象 - * @param string|Query $dbQuery + * @param string|Db|Query $dbQuery * @return Db|Query */ protected function buildQuery($dbQuery) diff --git a/vendor/zoujingli/think-library/src/Library.php b/vendor/zoujingli/think-library/src/Library.php index b26e6dca2..bd7588ee0 100644 --- a/vendor/zoujingli/think-library/src/Library.php +++ b/vendor/zoujingli/think-library/src/Library.php @@ -70,7 +70,7 @@ class Library extends Service // 替换 ThinkPHP 地址 $this->app->bind('think\route\Url', BuildUrl::class); // 替换 ThinkPHP 指令 - $this->commands(['build' => Build::class, 'clear' => Clear::class]); + $this->commands(['build' => Build::class]); // 注册 ThinkAdmin 指令 $this->commands([Queue::class, Install::class, Version::class, Database::class, Replace::class]); // 动态应用运行参数 @@ -120,10 +120,5 @@ class Library extends Service // 动态加载应用初始化系统函数 [$ds, $base] = [DIRECTORY_SEPARATOR, $this->app->getBasePath()]; foreach (glob("{$base}*{$ds}sys.php") as $file) includeFile($file); - // 动态加载插件初始化系统函数 - $base = "{$this->app->getBasePath()}addons{$ds}"; - if (file_exists($base) && is_dir($base)) { - foreach (glob("{$base}*{$ds}sys.php") as $file) includeFile($file); - } } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/Queue.php b/vendor/zoujingli/think-library/src/Queue.php index 8a04a350e..23ed2f0f6 100644 --- a/vendor/zoujingli/think-library/src/Queue.php +++ b/vendor/zoujingli/think-library/src/Queue.php @@ -62,16 +62,13 @@ abstract class Queue abstract public function execute(array $data = []); /** - * 设置任务的进度 - * @param null|string $message 进度消息 - * @param null|string $progress 进度数值 - * @param integer $backline 回退行数 - * @return Queue + * 设置失败的消息 + * @param string $message 消息内容 + * @throws Exception */ - protected function setQueueProgress(?string $message = null, ?string $progress = null, int $backline = 0): Queue + protected function setQueueError(string $message): void { - $this->queue->progress(2, $message, $progress, $backline); - return $this; + $this->queue->error($message); } /** @@ -85,12 +82,29 @@ abstract class Queue } /** - * 设置失败的消息 - * @param string $message 消息内容 - * @throws Exception + * 更新任务进度 + * @param integer $total 记录总和 + * @param integer $count 当前记录 + * @param string $message 文字描述 + * @param integer $backline 回退行数 + * @return static */ - protected function setQueueError(string $message): void + protected function setQueueMessage(int $total, int $count, string $message = '', int $backline = 0): Queue { - $this->queue->error($message); + $this->queue->message($total, $count, $message, $backline); + return $this; + } + + /** + * 设置任务的进度 + * @param null|string $message 进度消息 + * @param null|string $progress 进度数值 + * @param integer $backline 回退行数 + * @return Queue + */ + protected function setQueueProgress(?string $message = null, ?string $progress = null, int $backline = 0): Queue + { + $this->queue->progress(2, $message, $progress, $backline); + return $this; } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/Storage.php b/vendor/zoujingli/think-library/src/Storage.php index fa2a1499e..48c71c4a1 100644 --- a/vendor/zoujingli/think-library/src/Storage.php +++ b/vendor/zoujingli/think-library/src/Storage.php @@ -198,7 +198,8 @@ abstract class Storage curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); - [$content] = [curl_exec($ch), curl_close($ch)]; + $content = curl_exec($ch); + curl_close($ch); return $content ?: ''; } diff --git a/vendor/zoujingli/think-library/src/command/Database.php b/vendor/zoujingli/think-library/src/command/Database.php index 7b2ee3e0c..704f55a76 100644 --- a/vendor/zoujingli/think-library/src/command/Database.php +++ b/vendor/zoujingli/think-library/src/command/Database.php @@ -63,11 +63,11 @@ class Database extends Command [$tables, $total, $count] = SystemService::instance()->getTables(); $this->setQueueProgress("总共需要修复 {$total} 张数据表", '0'); foreach ($tables as $table) { - $this->queue->message($total, ++$count, "正在修复数据表 {$table}"); + $this->setQueueMessage($total, ++$count, "正在修复数据表 {$table}"); $this->app->db->query("REPAIR TABLE `{$table}`"); - $this->queue->message($total, $count, "完成修复数据表 {$table}", 1); + $this->setQueueMessage($total, $count, "完成修复数据表 {$table}", 1); } - $this->queue->success("已完成对 {$total} 张数据表修复操作"); + $this->setQueueSuccess("已完成对 {$total} 张数据表修复操作"); } /** @@ -80,11 +80,11 @@ class Database extends Command [$tables, $total, $count] = SystemService::instance()->getTables(); $this->setQueueProgress("总共需要优化 {$total} 张数据表", '0'); foreach ($tables as $table) { - $this->queue->message($total, ++$count, "正在优化数据表 {$table}"); + $this->setQueueMessage($total, ++$count, "正在优化数据表 {$table}"); $this->app->db->query("OPTIMIZE TABLE `{$table}`"); - $this->queue->message($total, $count, "完成优化数据表 {$table}", 1); + $this->setQueueMessage($total, $count, "完成优化数据表 {$table}", 1); } - $this->queue->success("已完成对 {$total} 张数据表优化操作"); + $this->setQueueSuccess("已完成对 {$total} 张数据表优化操作"); } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/command/Install.php b/vendor/zoujingli/think-library/src/command/Install.php index 8004fa54e..d7629aa81 100644 --- a/vendor/zoujingli/think-library/src/command/Install.php +++ b/vendor/zoujingli/think-library/src/command/Install.php @@ -153,5 +153,4 @@ class Install extends Command { return true; } - } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/command/Replace.php b/vendor/zoujingli/think-library/src/command/Replace.php index 4dec32d9c..6bc883b6e 100644 --- a/vendor/zoujingli/think-library/src/command/Replace.php +++ b/vendor/zoujingli/think-library/src/command/Replace.php @@ -51,12 +51,12 @@ class Replace extends Command { $search = $input->getArgument('search'); $repalce = $input->getArgument('replace'); - if ($search === '') $this->queue->error('查找替换字符内容不能为空!'); - if ($repalce === '') $this->queue->error('目标替换字符内容不能为空!'); + if ($search === '') $this->setQueueError('查找替换字符内容不能为空!'); + if ($repalce === '') $this->setQueueError('目标替换字符内容不能为空!'); [$tables, $total, $count] = SystemService::instance()->getTables(); foreach ($tables as $table) { $data = []; - $this->queue->message($total, ++$count, sprintf("准备替换数据表 %s", Str::studly($table))); + $this->setQueueMessage($total, ++$count, sprintf("准备替换数据表 %s", Str::studly($table))); foreach ($this->app->db->table($table)->getFields() as $field => $attrs) { if (preg_match('/char|text/', $attrs['type'])) { $data[$field] = $this->app->db->raw(sprintf('REPLACE(`%s`,"%s","%s")', $field, $search, $repalce)); @@ -64,14 +64,14 @@ class Replace extends Command } if (count($data) > 0) { if ($this->app->db->table($table)->where('1=1')->update($data) !== false) { - $this->queue->message($total, $count, sprintf("成功替换数据表 %s", Str::studly($table)), 1); + $this->setQueueMessage($total, $count, sprintf("成功替换数据表 %s", Str::studly($table)), 1); } else { - $this->queue->message($total, $count, sprintf("失败替换数据表 %s", Str::studly($table)), 1); + $this->setQueueMessage($total, $count, sprintf("失败替换数据表 %s", Str::studly($table)), 1); } } else { - $this->queue->message($total, $count, sprintf("无需替换数据表 %s", Str::studly($table)), 1); + $this->setQueueMessage($total, $count, sprintf("无需替换数据表 %s", Str::studly($table)), 1); } } - $this->queue->success('批量替换成功'); + $this->setQueueSuccess("批量替换 {$total} 张数据表成功"); } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/helper/TokenHelper.php b/vendor/zoujingli/think-library/src/helper/TokenHelper.php index 0c9cd781c..a88124707 100644 --- a/vendor/zoujingli/think-library/src/helper/TokenHelper.php +++ b/vendor/zoujingli/think-library/src/helper/TokenHelper.php @@ -39,7 +39,7 @@ class TokenHelper extends Helper $this->class->csrf_state = true; if ($this->app->request->isPost() && !TokenService::instance()->checkFormToken()) { if ($return) return false; - $this->class->error($this->class->csrf_message); + $this->class->error($this->class->csrf_message ?: lang('think_library_csrf_error')); } else { return true; } diff --git a/vendor/zoujingli/think-library/src/multiple/BuildUrl.php b/vendor/zoujingli/think-library/src/multiple/BuildUrl.php index d82cd55af..492eeb846 100644 --- a/vendor/zoujingli/think-library/src/multiple/BuildUrl.php +++ b/vendor/zoujingli/think-library/src/multiple/BuildUrl.php @@ -159,12 +159,6 @@ class BuildUrl extends Url $file = 'index.php'; } } - /*=====- 插件 Addons URL 处理 - 开始 -=====*/ - if (preg_match("#^{$depr}addons-{$app}({$depr}|\.|$)#i", $uri)) { - [$pre, $suf] = explode($depr, $url . $depr, 2); - if ($pre === $app) $url = rtrim("addons-{$app}{$depr}{$suf}", $depr); - } - /*=====- 插件 Addons URL 处理 - 结束 -=====*/ $url = rtrim($file, '/') . '/' . ltrim($url, '/'); // URL后缀 if ('/' == substr($url, -1) || '' == $url) { diff --git a/vendor/zoujingli/think-library/src/multiple/Multiple.php b/vendor/zoujingli/think-library/src/multiple/Multiple.php index ca3efa4ec..cb599f4ff 100644 --- a/vendor/zoujingli/think-library/src/multiple/Multiple.php +++ b/vendor/zoujingli/think-library/src/multiple/Multiple.php @@ -1,15 +1,16 @@ +// | 开源协议 ( https://mit-license.org ) // +---------------------------------------------------------------------- -// 以下代码来自 topthink/think-multi-app,有部分修改以兼容 ThinkAdmin 的需求 +// | gitee 代码仓库:https://gitee.com/zoujingli/ThinkLibrary +// | github 代码仓库:https://github.com/zoujingli/ThinkLibrary // +---------------------------------------------------------------------- declare (strict_types=1); @@ -64,7 +65,7 @@ class Multiple * @param Closure $next * @return Response */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { if (!$this->parseMultiApp()) return $next($request); return $this->app->middleware->pipeline('app')->send($request)->then(function ($request) use ($next) { @@ -121,14 +122,12 @@ class Multiple $appName = $map['*']; } else { $appName = $name ?: $defaultApp; - if (stripos($appName, 'addons-') !== 0) { - if (!is_dir($this->path ?: $this->app->getBasePath() . $appName)) { - if ($this->app->config->get('app.app_express', false)) { - $this->setApp($defaultApp); - return true; - } else { - return false; - } + if (!is_dir($this->path ?: $this->app->getBasePath() . $appName)) { + if ($this->app->config->get('app.app_express', false)) { + $this->setApp($defaultApp); + return true; + } else { + return false; } } } @@ -149,19 +148,13 @@ class Multiple private function setApp(string $appName): void { $space = $this->app->config->get('app.app_namespace') ?: 'app'; - if (stripos($appName, 'addons-') === 0) { - $appName = substr($appName, strlen('addons-')); - $this->app->setNamespace("{$space}\\addons\\{$appName}"); - $appPath = $this->path ?: $this->app->getBasePath() . 'addons' . DIRECTORY_SEPARATOR . $appName . DIRECTORY_SEPARATOR; - } else { - $this->app->setNamespace("{$space}\\{$appName}"); - $appPath = $this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR; - } + $appPath = $this->path ?: $this->app->getBasePath() . $appName . DIRECTORY_SEPARATOR; + // 动态设置多应用变量 $this->app->setAppPath($appPath); + $this->app->setNamespace("{$space}\\{$appName}"); $this->app->http->name($appName); if (is_dir($appPath)) { - $this->app->setRuntimePath($this->app->getRuntimePath() . $appName . DIRECTORY_SEPARATOR); - $this->app->http->setRoutePath($this->app->getAppPath() . 'route' . DIRECTORY_SEPARATOR); + $this->app->http->setRoutePath($appPath . 'route' . DIRECTORY_SEPARATOR); $this->loadApp($appPath); } } @@ -199,11 +192,7 @@ class Multiple */ private function scriptName(): string { - if (isset($_SERVER['SCRIPT_FILENAME'])) { - $file = $_SERVER['SCRIPT_FILENAME']; - } elseif (isset($_SERVER['argv'][0])) { - $file = realpath($_SERVER['argv'][0]); - } - return isset($file) ? pathinfo($file, PATHINFO_FILENAME) : ''; + $file = $_SERVER['SCRIPT_FILENAME'] ?? ($_SERVER['argv'][0] ?? ''); + return empty($file) ? '' : pathinfo($file, PATHINFO_FILENAME); } } \ No newline at end of file diff --git a/vendor/zoujingli/think-library/src/multiple/command/Clear.php b/vendor/zoujingli/think-library/src/multiple/command/Clear.php deleted file mode 100644 index 3a5009721..000000000 --- a/vendor/zoujingli/think-library/src/multiple/command/Clear.php +++ /dev/null @@ -1,99 +0,0 @@ - -// +---------------------------------------------------------------------- - -declare (strict_types=1); - -namespace think\admin\multiple\command; - -use think\console\Command; -use think\console\Input; -use think\console\input\Argument; -use think\console\input\Option; -use think\console\Output; - -/** - * 清理运行缓存 - * Class Clear - * @package think\admin\multiple\command - */ -class Clear extends Command -{ - protected function configure() - { - $this->setName('clear')->addArgument('app', Argument::OPTIONAL, 'app name'); - $this->addOption('path', 'd', Option::VALUE_OPTIONAL, 'path to clear'); - $this->addOption('cache', 'c', Option::VALUE_NONE, 'clear cache file'); - $this->addOption('log', 'l', Option::VALUE_NONE, 'clear log file'); - $this->addOption('dir', 'r', Option::VALUE_NONE, 'clear empty dir'); - $this->addOption('expire', 'e', Option::VALUE_NONE, 'clear cache file if cache has expired'); - $this->setDescription('Clear runtime file'); - } - - /** - * @param Input $input - * @param Output $output - * @return void - */ - protected function execute(Input $input, Output $output) - { - $app = $input->getArgument('app') ?: ''; - $runtimePath = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . ($app ? $app . DIRECTORY_SEPARATOR : ''); - if ($input->getOption('cache')) { - $path = $runtimePath . 'cache'; - } elseif ($input->getOption('log')) { - $path = $runtimePath . 'log'; - } else { - $path = $input->getOption('path') ?: $runtimePath; - } - $rmdir = (bool)$input->getOption('dir'); - // --expire 仅当 --cache 时生效 - $expire = $input->getOption('expire') && $input->getOption('cache'); - $this->clear(rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR, $rmdir, $expire); - $output->writeln("Clear Successed"); - } - - /** - * 清处理指定目录 - * @param string $path 待清理目录 - * @param boolean $rmdir 是否目录 - * @param boolean $expire 有效时间 - */ - private function clear(string $path, bool $rmdir, bool $expire): void - { - foreach (is_dir($path) ? scandir($path) : [] as $file) { - if ('.' !== $file && '..' !== $file && is_dir($path . $file)) { - $this->clear($path . $file . DIRECTORY_SEPARATOR, $rmdir, $expire); - if ($rmdir) @rmdir($path . $file); - } elseif ('.gitignore' != $file && is_file($path . $file)) { - if ($expire) { - if ($this->cacheHasExpired($path . $file)) { - @unlink($path . $file); - } - } else { - @unlink($path . $file); - } - } - } - } - - /** - * 缓存文件是否已过期 - * @param $filename string 文件路径 - * @return boolean - */ - private function cacheHasExpired(string $filename): bool - { - $expire = (int)substr(file_get_contents($filename), 8, 12); - return 0 != $expire && time() - $expire > filemtime($filename); - } -} diff --git a/vendor/zoujingli/think-library/src/service/NodeService.php b/vendor/zoujingli/think-library/src/service/NodeService.php index 791f1795b..b2688d1a2 100644 --- a/vendor/zoujingli/think-library/src/service/NodeService.php +++ b/vendor/zoujingli/think-library/src/service/NodeService.php @@ -50,11 +50,7 @@ class NodeService extends Service */ public function getCurrent(string $type = ''): string { - $space = $this->app->getNamespace(); $prefix = strtolower($this->app->http->getName()); - if (preg_match("|\\\\addons\\\\{$prefix}$|", $space)) { - $prefix = "addons-{$prefix}"; - } // 获取应用前缀节点 if ($type === 'module') return $prefix; // 获取控制器前缀节点 @@ -123,9 +119,8 @@ class NodeService extends Service $name = substr($file, strlen(strtr($this->app->getRootPath(), '\\', '/')) - 1); if (preg_match("|^([\w/]+)/(\w+)/controller/(.+)\.php$|i", $name, $matches)) { [, $namespace, $appname, $classname] = $matches; - $addons = preg_match('|/addons$|', $namespace) ? 'addons-' : ''; $class = new ReflectionClass(strtr("{$namespace}/{$appname}/controller/{$classname}", '/', '\\')); - $prefix = strtolower(strtr("{$addons}{$appname}/{$this->nameTolower($classname)}", '\\', '/')); + $prefix = strtolower(strtr("{$appname}/{$this->nameTolower($classname)}", '\\', '/')); $data[$prefix] = $this->_parseComment($class->getDocComment() ?: '', $classname); foreach ($class->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { if (in_array($metname = $method->getName(), $ignores)) continue; diff --git a/vendor/zoujingli/think-library/src/service/ProcessService.php b/vendor/zoujingli/think-library/src/service/ProcessService.php index 43220a2c1..14520234f 100644 --- a/vendor/zoujingli/think-library/src/service/ProcessService.php +++ b/vendor/zoujingli/think-library/src/service/ProcessService.php @@ -17,6 +17,7 @@ declare (strict_types=1); namespace think\admin\service; +use think\admin\Library; use think\admin\Service; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; @@ -98,7 +99,7 @@ class ProcessService extends Service /** * 查询相关进程列表 * @param string $cmd 任务指令 - * @param string $name 程序名称 + * @param string $name 进程名称 * @return array */ public function query(string $cmd, string $name = 'php.exe'): array @@ -157,6 +158,15 @@ class ProcessService extends Service return PATH_SEPARATOR === ';'; } + /** + * 读取组件版本号 + * @return string + */ + public function version(): string + { + return Library::VERSION; + } + /** * 清除空白字符过滤 * @param string $content diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index 751ab9bd3..2bb8aee5e 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -273,7 +273,7 @@ class SystemService extends Service $this->app->console->call("optimize:schema", ["--connection={$connection}"]); foreach (NodeService::instance()->getModules() as $module) { $path = $this->app->getRootPath() . 'runtime' . DIRECTORY_SEPARATOR . $module; - file_exists($path) && is_dir($path) or mkdir($path, 0755, true); + file_exists($path) && is_dir($path) || mkdir($path, 0755, true); $this->app->console->call("optimize:route", [$module]); } } @@ -314,8 +314,9 @@ class SystemService extends Service $rows[] = "mode = {$data['mode']}"; foreach ($data['appmap'] as $key => $item) $rows[] = "appmap[{$key}] = {$item}"; foreach ($data['domain'] as $key => $item) $rows[] = "domain[{$key}] = {$item}"; - $filename = $this->app->getRootPath() . 'runtime/.env'; - file_put_contents($filename, "[RUNTIME]\n" . join("\n", $rows)); + // 数据配置保存文件 + $env = $this->app->getRootPath() . 'runtime/.env'; + file_put_contents($env, "[RUNTIME]\n" . join("\n", $rows)); return $this->bindRuntime($data); } @@ -327,8 +328,8 @@ class SystemService extends Service */ public function getRuntime(?string $name = null, array $default = []) { - $filename = $this->app->getRootPath() . 'runtime/.env'; - if (file_exists($filename)) $this->app->env->load($filename); + $env = $this->app->getRootPath() . 'runtime/.env'; + if (file_exists($env)) $this->app->env->load($env); $data = [ 'mode' => $this->app->env->get('RUNTIME_MODE') ?: 'debug', 'appmap' => $this->app->env->get('RUNTIME_APPMAP') ?: [],