Changeset View
Changeset View
Standalone View
Standalone View
core/units/helpers/backup_helper.php
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Backup all data | * Backup all data | ||||
* | * | ||||
* @return bool | * @return bool | ||||
*/ | */ | ||||
function initBackup() | function initBackup() | ||||
{ | { | ||||
/** @var FileHelper $file_helper */ | |||||
$file_helper = $this->Application->recallObject('FileHelper'); | $file_helper = $this->Application->recallObject('FileHelper'); | ||||
/* @var $file_helper FileHelper */ | |||||
if (!$file_helper->CheckFolder($this->path) || !is_writable($this->path)) { | if (!$file_helper->CheckFolder($this->path) || !is_writable($this->path)) { | ||||
$this->Application->SetVar('error_msg', $this->Application->Phrase('la_Text_backup_access')); | $this->Application->SetVar('error_msg', $this->Application->Phrase('la_Text_backup_access')); | ||||
return false; | return false; | ||||
} | } | ||||
$tables = $this->_getBackupTables(); | $tables = $this->_getBackupTables(); | ||||
▲ Show 20 Lines • Show All 432 Lines • ▼ Show 20 Line(s) | |||||
/** | /** | ||||
* Returns list of backup files, available for restore | * Returns list of backup files, available for restore | ||||
* | * | ||||
* @return Array | * @return Array | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function getBackupFiles() | public function getBackupFiles() | ||||
{ | { | ||||
/** @var FileHelper $file_helper */ | |||||
$file_helper = $this->Application->recallObject('FileHelper'); | $file_helper = $this->Application->recallObject('FileHelper'); | ||||
/* @var $file_helper FileHelper */ | |||||
$ret = Array (); | $ret = Array (); | ||||
$backup_path = $this->Application->ConfigValue('Backup_Path'); | $backup_path = $this->Application->ConfigValue('Backup_Path'); | ||||
$file_helper->CheckFolder($backup_path); | $file_helper->CheckFolder($backup_path); | ||||
$backup_files = glob($backup_path . DIRECTORY_SEPARATOR . 'dump*.txt'); | $backup_files = glob($backup_path . DIRECTORY_SEPARATOR . 'dump*.txt'); | ||||
if ( !$backup_files ) { | if ( !$backup_files ) { | ||||
return Array (); | return Array (); | ||||
} | } | ||||
foreach ($backup_files as $backup_file) { | foreach ($backup_files as $backup_file) { | ||||
$ret[] = Array ( | $ret[] = Array ( | ||||
'filedate' => preg_replace('/^dump([\d]+)\.txt$/', '\\1', basename($backup_file)), | 'filedate' => preg_replace('/^dump([\d]+)\.txt$/', '\\1', basename($backup_file)), | ||||
'filesize' => filesize($backup_file)); | 'filesize' => filesize($backup_file)); | ||||
} | } | ||||
rsort($ret); | rsort($ret); | ||||
return $ret; | return $ret; | ||||
} | } | ||||
} | } | ||||
No newline at end of file | No newline at end of file |