예제 #1
0
파일: cron.php 프로젝트: hackingman/LinkX
function CommandLineBackup($filename)
{
    global $C, $DB;
    $filename = "{$GLOBALS['BASE_DIR']}/data/" . basename($filename);
    $tables = array();
    IniParse("{$GLOBALS['BASE_DIR']}/includes/tables.php", TRUE, $tables);
    if ($C['mysqldump']) {
        $command = "{$C['mysqldump']} " . "-u" . escapeshellarg($C['db_username']) . " " . "-p" . escapeshellarg($C['db_password']) . " " . "-h" . escapeshellarg($C['db_hostname']) . " " . "--opt " . escapeshellarg($C['db_name']) . " " . join(' ', array_keys($tables)) . " >" . escapeshellarg($filename) . " 2>&1";
        exec($command);
    } else {
        DoBackup($filename, $tables);
    }
    StoreValue('last_backup', time());
}
예제 #2
0
function CommandLineBackup($filename)
{
    global $C, $DB;
    if (IsEmptyString($filename)) {
        trigger_error('A filename must be supplied', E_USER_ERROR);
    }
    $filename = "{$GLOBALS['BASE_DIR']}/data/" . basename($filename);
    $tables = array();
    IniParse("{$GLOBALS['BASE_DIR']}/includes/tables.php", TRUE, $tables);
    if (!$C['safe_mode'] && $C['mysqldump']) {
        $command = "{$C['mysqldump']} " . "-u" . escapeshellarg($C['db_username']) . " " . "-p" . escapeshellarg($C['db_password']) . " " . "-h" . escapeshellarg($C['db_hostname']) . " " . "--opt " . escapeshellarg($C['db_name']) . " " . join(' ', array_keys($tables)) . " >" . escapeshellarg($filename) . " 2>&1";
        shell_exec($command);
    } else {
        DoBackup($filename, $tables);
    }
    StoreValue('last_backup', MYSQL_NOW);
    @chmod($filename, 0666);
}
예제 #3
0
파일: backup.php 프로젝트: nicolaisi/adei
        
        	}
        */
        /*	
        	$cprops = $props;
        	foreach (array_keys($groups) as $group) {
        	    $cprops['db_group'] = $group;
        	    $lg = new LOGGROUP($cprops);
        	    $zlg = new ZEUSLogGroup($lg);
        	    
        	    $cache = new CACHE($cprops, $zeus);
        	    $cache->Update();
        	}*/
    } catch (ADEIException $e) {
        $e->logInfo("Backup is failed", $reader ? $reader : $req);
        $error = $e->getInfo();
    }
    return $error ? $error : 0;
}
$req = new REQUEST($config);
$list = $req->GetSources();
foreach ($list as $sreq) {
    $opts =& $sreq->GetOptions();
    $backup = $opts->Get('backup');
    if ($backup) {
        $err = DoBackup($sreq, $backup);
        if ($err) {
            echo $sreq->GetLocationString() . ", Error: {$err}\n";
        }
    }
}
예제 #4
0
파일: index.php 프로젝트: hackingman/LinkX
function lxBackupDatabase()
{
    global $DB, $C;
    VerifyAdministrator();
    CheckAccessList();
    $filename = SafeFilename("{$GLOBALS['BASE_DIR']}/data/{$_REQUEST['filename']}", FALSE);
    $tables = array();
    IniParse("{$GLOBALS['BASE_DIR']}/includes/tables.php", TRUE, $tables);
    $GLOBALS['message'] = 'Database backup is in progress, allow a few minutes to complete before downloading the backup file';
    // Run mysqldump in the background
    if ($C['allow_exec'] && !empty($C['mysqldump'])) {
        $command = "{$C['mysqldump']} " . "-u" . escapeshellarg($C['db_username']) . " " . "-p" . escapeshellarg($C['db_password']) . " " . "-h" . escapeshellarg($C['db_hostname']) . " " . "--opt " . escapeshellarg($C['db_name']) . " " . join(' ', array_keys($tables)) . " >" . escapeshellarg($filename) . " 2>&1 &";
        exec($command);
    } else {
        if ($C['allow_exec'] && !empty($C['php_cli'])) {
            exec("{$C['php_cli']} cron.php --backup " . escapeshellarg($filename) . " >/dev/null 2>&1 &");
        } else {
            DoBackup($filename, $tables);
            $GLOBALS['message'] = 'Database backup has been completed';
        }
    }
    StoreValue('last_backup', time());
    lxShDatabaseTools();
}