Browse Source

压缩前删除旧的压缩文件

visuddhinanda 2 years ago
parent
commit
1a36fb807f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/Console/Commands/ExportZip.php

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

@@ -70,6 +70,10 @@ class ExportZip extends Command
         }
         }
         $zipFullFileName = storage_path($exportPath.'/'.$zipFile);
         $zipFullFileName = storage_path($exportPath.'/'.$zipFile);
 
 
+        unlink($zipFullFileName);
+
+        Log::debug('export offline: delete old file:'.$zipFullFileName);
+
         shell_exec("cd ".storage_path($exportPath));
         shell_exec("cd ".storage_path($exportPath));
         if($this->argument('format')==='7z'){
         if($this->argument('format')==='7z'){
             $command = "7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on {$zipFullFileName} {$exportFullFileName}";
             $command = "7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on {$zipFullFileName} {$exportFullFileName}";