Browse Source

add mkdir

visuddhinanda 2 years ago
parent
commit
9c29e18fbc
1 changed files with 12 additions and 2 deletions
  1. 12 2
      app/Console/Commands/ExportOffline.php

+ 12 - 2
app/Console/Commands/ExportOffline.php

@@ -39,16 +39,26 @@ class ExportOffline extends Command
      */
      */
     public function handle()
     public function handle()
     {
     {
-        $exportStop = storage_path('app/public/export/offline/.stop');
+        $exportDir = storage_path('app/public/export/offline');
+        if(!is_dir($exportDir)){
+            $res = mkdir($exportDir,0700,true);
+            if(!$res){
+                Log::error('mkdir fail path='.$exportDir);
+                return 1;
+            }
+        }
+        $exportStop = $exportDir.'/.stop';
         $file = fopen($exportStop,'w');
         $file = fopen($exportStop,'w');
         fclose($file);
         fclose($file);
+             
         //建表
         //建表
         $this->info('create db');
         $this->info('create db');
         $this->call('export:create.db');
         $this->call('export:create.db');
+
         //term
         //term
         $this->info('term');
         $this->info('term');
         $this->call('export:term');
         $this->call('export:term');
-
+        
         //导出channel
         //导出channel
         $this->info('channel');
         $this->info('channel');
         $this->call('export:channel');
         $this->call('export:channel');