* [misc] remove unused code of backup files compressed in zip format.

This commit is contained in:
liugang
2024-07-09 14:14:08 +08:00
committed by 王怡栋
parent 67904e87d6
commit e0a3b08229
2 changed files with 2 additions and 27 deletions
-10
View File
@@ -268,16 +268,6 @@ class backup extends control
$this->backup->removeFileHeader($this->backupPath . $fileName . '.sql.php');
rename($this->backupPath . $fileName . '.sql.php', $this->backupPath . $fileName . '.sql');
}
if(file_exists($this->backupPath . $fileName . '.file.zip.php'))
{
$this->backup->removeFileHeader($this->backupPath . $fileName . '.file.zip.php');
rename($this->backupPath . $fileName . '.file.zip.php', $this->backupPath . $fileName . '.file.zip');
}
if(file_exists($this->backupPath . $fileName . '.code.zip.php'))
{
$this->backup->removeFileHeader($this->backupPath . $fileName . '.code.zip.php');
rename($this->backupPath . $fileName . '.code.zip.php', $this->backupPath . $fileName . '.code.zip');
}
return $this->send(array('result' => 'success', 'load' => true));
}
+2 -17
View File
@@ -162,20 +162,7 @@ class backupModel extends model
$return->result = true;
$return->error = '';
if(is_file($backupFile))
{
$oldDir = getcwd();
chdir($this->app->getTmpRoot());
$this->app->loadClass('pclzip', true);
$zip = new pclzip($backupFile);
if($zip->extract(PCLZIP_OPT_PATH, $this->app->getAppRoot() . 'www/data/', PCLZIP_OPT_TEMP_FILE_ON) == 0)
{
$return->result = false;
$return->error = $zip->errorInfo();
}
chdir($oldDir);
}
elseif(is_dir($backupFile))
if(is_dir($backupFile))
{
$zfile = $this->app->loadClass('zfile');
$zfile->copyDir($backupFile, $this->app->getAppRoot() . 'www/data/', $showDetails = false);
@@ -299,9 +286,7 @@ class backupModel extends model
}
else
{
if(file_exists($backupPath . $name . ".{$type}")) return $backupPath . $name . ".{$type}";
if(file_exists($backupPath . $name . ".{$type}.zip")) return $backupPath . $name . ".{$type}.zip";
if(file_exists($backupPath . $name . ".{$type}.zip.php")) return $backupPath . $name . ".{$type}.zip.php";
if(file_exists($backupPath . $name . ".{$type}")) return $backupPath . $name . ".{$type}";
}
return false;