Ver código fonte

fix(extension): 修改扩展配置命令和管理器中的默认值处理在 CoreExtensionConfigCommand 中,当数据库查询失败时,默认安装模块列表改为包含 'system'。
在 ExtensionManager 中,移除了 author 字段的 require 验证,并在缺失时默认设置为 '未知'。

runphp 6 meses atrás
pai
commit
ca40b57fdd

+ 1 - 1
src/Command/CoreExtensionConfigCommand.php

@@ -33,7 +33,7 @@ class CoreExtensionConfigCommand extends Command
             $installModuleList = ExtensionModel::where('status', '>', 1)
                 ->column('id');
         } catch (PDOException $e) {
-            $installModuleList = [];
+            $installModuleList = ['system'];
         }
         foreach ($moduleList as $moduleName) {
             $extension = $extensionManager->getExtension($moduleName);

+ 4 - 1
src/ExtensionManager.php

@@ -212,7 +212,7 @@ class ExtensionManager extends Service
                 'description' => 'max:65535',
                 'version' => 'max:20',
                 'core_version' => 'max:20',
-                'author' => 'require|max:100',
+                'author' => 'max:100',
                 'email' => 'email|max:100',
                 'website' => 'url|max:255',
                 'image' => 'url|max:255',
@@ -230,6 +230,9 @@ class ExtensionManager extends Service
         if (!isset($extensionInfo['core_version'])) {
             $extensionInfo['core_version'] = '^1.0';
         }
+        if (!isset($extensionInfo['author'])) {
+            $extensionInfo['author'] = '未知';
+        }
         $extension = ExtensionModel::where(['id' => $name])->append(['status_text'])->findOrEmpty();
         if ($extension->isEmpty()) {
             $extensionInfo['status'] = 1; // 下载的扩展默认未安装