Przeglądaj źródła

refactor(backend): 移除查询 is_core 字段的条件

runphp 6 miesięcy temu
rodzic
commit
af057e9d66
1 zmienionych plików z 6 dodań i 5 usunięć
  1. 6 5
      src/Command/CoreExtensionConfigCommand.php

+ 6 - 5
src/Command/CoreExtensionConfigCommand.php

@@ -10,6 +10,8 @@ use SixShop\System\Model\ExtensionModel;
 use think\console\Command;
 use think\db\exception\PDOException;
 
+use function SixShop\Core\extension_name_list;
+
 class CoreExtensionConfigCommand extends Command
 {
     public function configure(): void
@@ -25,11 +27,10 @@ class CoreExtensionConfigCommand extends Command
         $force = $this->input->getOption('force');
         $extensionManager = $this->app->make(ExtensionManager::class);
         // 确保系统扩展迁移已安装
-        $moduleList = array_diff(Helper::extension_name_list(), ['system']);
+        $moduleList = array_diff(extension_name_list(), ['system']);
         array_unshift($moduleList, 'system');
         try {
-            $installModuleList = ExtensionModel::where(['is_core' => 0])
-                ->where('status', '>', 1)
+            $installModuleList = ExtensionModel::where('status', '>', 1)
                 ->column('id');
         } catch (PDOException $e) {
             $installModuleList = [];
@@ -42,7 +43,7 @@ class CoreExtensionConfigCommand extends Command
             } catch (PDOException $e) {
                 $config = [];
             }
-            if ((isset($info['is_core']) && $info['is_core'] == 1) || in_array($moduleName, $installModuleList)) {
+            if (in_array($moduleName, $installModuleList)) {
                 $migrate = app(Migrate::class, [$this->app, $moduleName], true);
                 if ($force) {
                     $migrate->uninstall();
@@ -74,4 +75,4 @@ class CoreExtensionConfigCommand extends Command
         $this->output->writeln('');
         $this->output->writeln('<comment>All Done. Took ' . sprintf('%.4fs', $end - $start) . '</comment>');
     }
-}
+}