1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 17:01:43 +02:00

Scheduled Tasks: Database Backup now zips up the .sql file.

This commit is contained in:
Cameron
2015-04-06 13:59:15 -07:00
parent cfd438c827
commit b6dfef6b62
4 changed files with 34 additions and 7 deletions

View File

@@ -231,9 +231,26 @@ class _system_cron
{
$sql = e107::getDb();
$sql->backup('*');
$file = $sql->backup('*');
if(empty($file))
{
e107::getLog()->addError('Database Backup Failed:'.basename($file))->save('BACKUP');
return;
}
$zipFile = $file.".zip";
e107::getFile()->zip(array($file),$zipFile, array('remove_path'=>e_BACKUP));
if(file_exists($zipFile))
{
e107::getLog()->addSuccess('Database Backup Complete:'.basename($zipFile))->save('BACKUP');
if(is_file($file))
{
unlink($file);
}
}
return;

View File

@@ -970,7 +970,7 @@ class e_file
* @param string $newFile
*/
public function zip($filePaths=null, $newFile='')
public function zip($filePaths=null, $newFile='', $options=array())
{
if(empty($newFile))
{
@@ -984,8 +984,10 @@ class e_file
require_once(e_HANDLER.'pclzip.lib.php');
$archive = new PclZip($newFile);
if ($archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH,e_BASE) == 0)
$removePath = (!empty($options['remove_path'])) ? $options['remove_path'] : e_BASE;
if ($archive->create($filePaths, PCLZIP_OPT_REMOVE_PATH, $removePath) == 0)
{
$error = $archive->errorInfo(true);
e107::getAdminLog()->addError($error)->save('FILE',E_LOG_NOTICE);

View File

@@ -600,6 +600,14 @@ class e_pref extends e_front_model
}
$log->addSuccess('Settings successfully saved.', ($session_messages === null || $session_messages === true));
$uid = USERID;
if(empty($uid)) // Log extra details of any pref changes made by a non-user.
{
$log->addWarning(print_r(debug_backtrace(null,2), true), false);
}
$log->save($logId);
// if(!$disallow_logs) $log->logSuccess('Settings successfully saved.', true, $session_messages)->flushMessages($logId, E_LOG_INFORMATIVE, '', $this->prefid);

View File

@@ -21,7 +21,7 @@
$cron[] = array(
'name' => "Unanswered Questions Report", //TODO LAN
'function' => "unanswered",
'category' => "report",
'category' => "notify",
'description' => "Mails a report of unanswered questions to ".e107::pref('core','siteadminemail').'.' // TODO LAN
);