Beispiel #1
0
function tbxDatabaseRestore()
{
    Privileges::Check(Privileges::DATABASE);
    $filename = BASE_DIR . '/data/' . File::Sanitize(Request::Get('filename'));
    if (!is_file($filename)) {
        return JSON::Failure('The file you have selected no longer exists on the server.');
    }
    $si = ServerInfo::GetCached();
    if (!$si->shell_exec_disabled && $si->binaries[ServerInfo::BIN_PHP]) {
        Shell::ExecScript('cron.php --restore --file=' . escapeshellarg($filename));
        JSON::Success('Database restore has been started.  Allow a few minutes to complete, then continue with the next step of the restore process.');
    } else {
        $DB = GetDB();
        $DB->RestoreTables($filename);
        JSON::Success('Database restore has been completed');
    }
}