From e0a3b0822936bb55ddd6f6b3c2207e2c0a2dbfc6 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 9 Jul 2024 14:04:02 +0800 Subject: [PATCH] * [misc] remove unused code of backup files compressed in zip format. --- module/backup/control.php | 10 ---------- module/backup/model.php | 19 ++----------------- 2 files changed, 2 insertions(+), 27 deletions(-) diff --git a/module/backup/control.php b/module/backup/control.php index c92c563ebe..a4dc6f75e0 100644 --- a/module/backup/control.php +++ b/module/backup/control.php @@ -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)); } diff --git a/module/backup/model.php b/module/backup/model.php index 7030202f45..f919679233 100644 --- a/module/backup/model.php +++ b/module/backup/model.php @@ -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;