* change for task #5228.
This commit is contained in:
@@ -81,7 +81,7 @@ class backup extends control
|
||||
public function backup($reload = 'no')
|
||||
{
|
||||
if($reload == 'yes') session_write_close();
|
||||
set_time_limit(7200);
|
||||
set_time_limit(0);
|
||||
$nozip = strpos($this->config->backup->setting, 'nozip') !== false;
|
||||
$nofile = strpos($this->config->backup->setting, 'nofile') !== false;
|
||||
$nosafe = strpos($this->config->backup->setting, 'nosafe') !== false;
|
||||
@@ -147,7 +147,7 @@ class backup extends control
|
||||
}
|
||||
|
||||
/* Delete expired backup. */
|
||||
$backupFiles = glob("{$this->backupPath}*.php");
|
||||
$backupFiles = glob("{$this->backupPath}*.*");
|
||||
if(!empty($backupFiles))
|
||||
{
|
||||
$time = time();
|
||||
@@ -179,7 +179,7 @@ class backup extends control
|
||||
{
|
||||
if($confirm == 'no') $this->send(array('result' => 'fail', 'message' => $this->lang->backup->confirmRestore));
|
||||
|
||||
set_time_limit(7200);
|
||||
set_time_limit(0);
|
||||
|
||||
/* Restore database. */
|
||||
if(file_exists("{$this->backupPath}{$fileName}.sql.php"))
|
||||
@@ -373,24 +373,21 @@ class backup extends control
|
||||
if($sqlFileName)
|
||||
{
|
||||
$fileSize = $this->backup->getBackupSize($sqlFileName);
|
||||
$fileSize = $fileSize / 1024 >= 1024 ? round($fileSize / 1024 / 1024, 2) . 'MB' : round($fileSize / 1024, 2) . 'KB';
|
||||
$message = sprintf($this->lang->backup->progressSQL, $fileSize);
|
||||
$message = sprintf($this->lang->backup->progressSQL, $this->backup->processFileSize($fileSize));
|
||||
}
|
||||
|
||||
$attachFileName = $this->backup->getBackupFile($fileName, 'file');
|
||||
if($attachFileName)
|
||||
{
|
||||
$fileSize = $this->backup->getBackupSize($attachFileName);
|
||||
$fileSize = $fileSize / 1024 >= 1024 ? round($fileSize / 1024 / 1024, 2) . 'MB' : round($fileSize / 1024, 2) . 'KB';
|
||||
$message = sprintf($this->lang->backup->progressAttach, $fileSize);
|
||||
$message = sprintf($this->lang->backup->progressAttach, $this->backup->processFileSize($fileSize));
|
||||
}
|
||||
|
||||
$codeFileName = $this->backup->getBackupFile($fileName, 'code');
|
||||
if($codeFileName)
|
||||
{
|
||||
$fileSize = $this->backup->getBackupSize($codeFileName);
|
||||
$fileSize = $fileSize / 1024 >= 1024 ? round($fileSize / 1024 / 1024, 2) . 'MB' : round($fileSize / 1024, 2) . 'KB';
|
||||
$message = sprintf($this->lang->backup->progressCode, $fileSize);
|
||||
$message = sprintf($this->lang->backup->progressCode, $this->backup->processFileSize($fileSize));
|
||||
}
|
||||
die($message);
|
||||
}
|
||||
|
||||
@@ -311,4 +311,29 @@ class backupModel extends model
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process filesize.
|
||||
*
|
||||
* @param int $fileSize
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function processFileSize($fileSize)
|
||||
{
|
||||
$bit = 'KB';
|
||||
$fileSize = round($fileSize / 1024, 2);
|
||||
if($fileSize >= 1024)
|
||||
{
|
||||
$bit = 'MB';
|
||||
$fileSize = round($fileSize / 1024, 2);
|
||||
}
|
||||
if($fileSize >= 1024)
|
||||
{
|
||||
$bit = 'GB';
|
||||
$fileSize = round($fileSize / 1024, 2);
|
||||
}
|
||||
|
||||
return $fileSize . $bit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user