visuddhinanda 2 anos atrás
pai
commit
c3d68067e1

+ 2 - 2
app/Console/Commands/ExportChannel.php

@@ -16,7 +16,7 @@ class ExportChannel extends Command
      *
      * @var string
      */
-    protected $signature = 'export:channel';
+    protected $signature = 'export:channel {db}';
 
     /**
      * The console command description.
@@ -46,7 +46,7 @@ class ExportChannel extends Command
             return 0;
         }
         Log::debug('task export offline channel-table start');
-        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
+        $exportFile = storage_path('app/public/export/offline/'.$this->argument('db').'-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();

+ 3 - 2
app/Console/Commands/ExportChapterIndex.php

@@ -17,7 +17,7 @@ class ExportChapterIndex extends Command
      *
      * @var string
      */
-    protected $signature = 'export:chapter.index';
+    protected $signature = 'export:chapter.index {db : db file name wikipali-offline or wikipali-offline-index}';
 
     /**
      * The console command description.
@@ -47,7 +47,8 @@ class ExportChapterIndex extends Command
         if(\App\Tools\Tools::isStop()){
             return 0;
         }
-        $exportFile = storage_path('app/public/export/offline/wikipali-offline-'.date("Y-m-d").'.db3');
+
+        $exportFile = storage_path('app/public/export/offline/'.$this->argument('db').'-'.date("Y-m-d").'.db3');
         $dbh = new \PDO('sqlite:'.$exportFile, "", "", array(\PDO::ATTR_PERSISTENT => true));
         $dbh->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_WARNING);
         $dbh->beginTransaction();

+ 4 - 3
app/Console/Commands/ExportZip.php

@@ -15,7 +15,7 @@ class ExportZip extends Command
      *
      * @var string
      */
-    protected $signature = 'export:zip {format?  : zip file format 7z,lzma,gz }';
+    protected $signature = 'export:zip {db : db filename} {format?  : zip file format 7z,lzma,gz }';
 
     /**
      * The console command description.
@@ -44,7 +44,8 @@ class ExportZip extends Command
         Log::debug('export offline: 开始压缩');
         $this->info('export offline: 开始压缩');
         $exportPath = 'app/public/export/offline';
-        $exportFile = 'wikipali-offline-'.date("Y-m-d").'.db3';
+        $exportFile = $this->argument('db').'-'.date("Y-m-d").'.db3';
+
         Log::debug('export offline: zip file {filename} {format}',
                     [
                         'filename'=>$exportFile,
@@ -141,7 +142,7 @@ class ExportZip extends Command
                    'filesize'=>filesize($zipFullFileName),
                    'min_app_ver'=>'1.3',
                     ];
-        RedisClusters::put('/offline/index',$info);
+        RedisClusters::put('/offline/index/'.$this->argument('db'),$info);
         unlink($exportFullFileName);
         return 0;
     }