2004-10-16 01:06:34 +02:00
|
|
|
<?php
|
2013-07-14 15:05:24 +02:00
|
|
|
/**
|
|
|
|
* EGroupware - Admin - DB backup and restore
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @package admin
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
2004-10-16 01:06:34 +02:00
|
|
|
|
2016-02-20 21:27:17 +01:00
|
|
|
use EGroupware\Api;
|
|
|
|
|
2013-07-14 15:05:24 +02:00
|
|
|
class admin_db_backup
|
|
|
|
{
|
|
|
|
var $public_functions = array(
|
|
|
|
'index' => true,
|
|
|
|
);
|
|
|
|
var $db_backup;
|
2004-10-16 01:06:34 +02:00
|
|
|
|
2013-07-14 15:05:24 +02:00
|
|
|
/**
|
|
|
|
* Method for sheduled backups, called via asynservice
|
|
|
|
*/
|
|
|
|
function do_backup()
|
|
|
|
{
|
2016-02-20 21:27:17 +01:00
|
|
|
$this->db_backup = new Api\Db\Backup();
|
2009-08-27 14:46:12 +02:00
|
|
|
|
2014-07-25 11:13:19 +02:00
|
|
|
if (($f = $this->db_backup->fopen_backup()))
|
2013-07-14 15:05:24 +02:00
|
|
|
{
|
|
|
|
$this->db_backup->backup($f);
|
|
|
|
if(is_resource($f))
|
|
|
|
fclose($f);
|
|
|
|
/* Remove old backups. */
|
|
|
|
$this->db_backup->housekeeping();
|
2009-08-27 14:46:12 +02:00
|
|
|
}
|
2013-07-14 15:05:24 +02:00
|
|
|
}
|
2009-08-27 14:46:12 +02:00
|
|
|
|
2013-07-14 15:05:24 +02:00
|
|
|
/**
|
|
|
|
* includes setup's db_backup to display/access it inside admin
|
|
|
|
*/
|
|
|
|
function index()
|
|
|
|
{
|
|
|
|
$tpl_root = EGW_SERVER_ROOT.'/setup/templates/default';
|
|
|
|
$self = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'admin.admin_db_backup.index'));
|
2016-04-27 21:12:20 +02:00
|
|
|
Api\Translation::add_app('setup');
|
|
|
|
Api\Header\ContentSecurityPolicy::add('script-src', 'unsafe-inline');
|
2004-10-16 01:06:34 +02:00
|
|
|
|
2013-07-14 15:05:24 +02:00
|
|
|
include EGW_SERVER_ROOT.'/setup/db_backup.php';
|
2004-10-16 01:06:34 +02:00
|
|
|
|
2014-07-25 11:13:19 +02:00
|
|
|
unset($tpl_root, $self);
|
2016-05-14 21:26:36 +02:00
|
|
|
echo $GLOBALS['egw']->framework->footer();
|
2009-08-27 14:46:12 +02:00
|
|
|
}
|
2013-07-14 15:05:24 +02:00
|
|
|
}
|