/** * db backup render start * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Modules * @author Henry Ruhs */ function db_backup_render_start() { if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == 'db-backup') { define('TITLE', l('database_backup', 'db_backup')); /* registry object */ $registry = Redaxscript\Registry::getInstance(); $registry->set('title', l('database_backup', 'db_backup')); /* config object */ $config = Redaxscript\Config::getInstance(); /* download database backup */ if (THIRD_PARAMETER == 'download') { define('RENDER_BREAK', 1); db_backup($config::get('name'), 0); } /* send database backup */ if (THIRD_PARAMETER == 'send') { define('CENTER_BREAK', 1); /* prepare body parts */ $urlLink = anchor_element('external', '', '', ROOT, ROOT); $fileName = $config::get('name') . '-' . db_backup_clean_date(NOW) . '.sql'; /* prepare mail inputs */ $toArray = $fromArray = array(s('author') => s('email')); $subject = l('database_backup', 'db_backup'); $bodyArray = array('<strong>' . l('url') . l('colon') . '</strong> ' . $urlLink, '<strong>' . l('database') . l('colon') . '</strong> ' . $config::get('name'), '<br />', '<strong>' . l('message') . l('colon') . '</strong> ' . l('save_attachment', 'db_backup') . l('point')); $attachmentArray = array($fileName => db_backup($config::get('name'), 1)); /* mail object */ $mail = new Redaxscript\Mailer($toArray, $fromArray, $subject, $bodyArray, $attachmentArray); $mail->send(); } } }
function generate_backup($conn, $ext = 'no', $comm = '') { $filename = db_backup($conn, $ext, $comm); if ($filename) { display_notification(_("Backup successfully generated.") . ' ' . _("Filename") . ": " . $filename); } else { display_error(_("Database backup failed.")); } return $filename; }
function db_deploy() { global $dbconnects, $db_settings, $db_tools; $stageFile = db_backup("stage"); $prodFile = db_backup("production"); if (!$stageFile || !$prodFile) { echo "<div class='messages error'><div class='message-icon'><i class='fa fa-exclamation-triangle' /></div><div class='message'>Deployment stopped because no backups were saved. Cannot proceed.</div></div>"; return false; } else { $out1 = $db_tools["mysql"] . " --host=" . $db_settings['productionhost'] . " --user="******" --password="******" locator_production < ../sql-files/{$stageFile}"; exec($out1, $output, $returncode); if ($returncode != 0) { echo "<div class='messages error'><div class='message-icon'><i class='fa fa-exclamation-triangle' /></div><div class='message'>An error occured, the stage environment could not be deployed. No change has been made to the production environment.</div></div>"; return false; } else { echo "<div class='messages status'><div class='message-icon'><i class='fa fa-check' /></div><div class='message'>The stage environment has been deployed to production. Both environments have been backed up.</div></div>"; move_files(); return true; } } }
if (filesize($zipfile) > 0) { unlink($backupFile); return true; } else { return false; } } else { return false; } } return true; } else { return false; } } $backup = db_backup(); if ($jobs['backup'][0] == 7) { $jobs['backup'][1] = $plus_week; } else { if ($jobs['backup'][0] == 30) { $jobs['backup'][1] = $plus_month; } else { $jobs['backup'][1] = $midnight_today; } } $message = $backup === true ? 'successful' : 'failed'; doLog("Database update " . $message . " - triggered by visitor " . $displayIp); } if ($update == 1) { $new_jobs = serialize($jobs); yasDB_update("UPDATE `settings` SET `jobs` = '{$new_jobs}' WHERE `id` = 1");
} } } return $ret; } $installers = get_installers(); if (get_post('Upgrade')) { $ret = true; foreach ($db_connections as $comp => $conn) { // connect to database if (!set_global_connection($comp)) { display_error(_("Cannot connect to database for company") . " '" . $conn['name'] . "'"); continue; } // create security backup db_backup($conn, 'no', 'Security backup before upgrade', $conn['tbpref']); // apply all upgrade data foreach ($installers as $i => $inst) { $ret = upgrade_step($i, $conn); if (!$ret) { display_error(sprintf(_("Database upgrade to version %s failed for company '%s'."), $inst->version, $conn['name']) . '<br>' . _('You should restore company database from latest backup file')); } } // db_close($conn); ? if (!$ret) { break; } } set_global_connection(); if ($ret) { // re-read the prefs
<?php include_once "../includes/locator.php"; include_once 'log/login.php'; ?> <html> <head> <title>Firestone Locator | Backup on Demand</title> </head> <body> <?php echo "<h1>Backup Process</h1>\n"; db_backup("stage"); ?> </body> </html>
<?php include_once "../includes/locator.php"; include_once 'log/login.php'; ?> <html> <head> <title>Firestone Locator | Database Restore</title> </head> <body> <?php echo "<h1>Restoration Process</h1>\n"; db_backup($_POST["env"]); db_restore("../sql-files/" . $_POST["file"], $_POST["env"]); ?> </body> </html>
} } else { return false; } } return true; } else { return false; } } $Start = getTime(); $mem_limit = substr(ini_get("memory_limit"), 0, -1); set_time_limit(300); //include('backup.class.php'); if (isset($_POST['create'])) { $db_success = db_backup(); } ?> <div id="center-column"> <div class="top-bar"> <h1>Cpanel - Database Backup</h1> <div class="breadcrumbs"><a href="index.php?act=gainfo" title="Google Analytics Info">Google Analytics Login Info</a></div> </div><br /> <div class="select-bar"> <label> <h3>Backup Arcade Database</h3> </label> </div> <div style="font-size:14px;text-align:center;"> <form id="db_backup" method="post" action="index.php?act=managedbbackup"> <label>Create a database backup</label>
# type: bool (true structure only) # droptable: bool # deleteall: bool # download: bool # bansonly: bool $user_msg = db_backup($type, $droptable, $deleteall, $download, false); } //create bans .sql backup if (isset($_POST["dbbansexp"])) { $download = isset($_POST["download"]) ? true : false; # type: bool (true structure only) # droptable: bool # deleteall: bool # download: bool # bansonly: bool $user_msg = db_backup(false, true, false, $download, true); } //import banned.cfg if (isset($_POST["bancfgupl"])) { $reason = mysql_real_escape_string($_POST["reason"]); $plnick = mysql_real_escape_string($_POST["player_nick"]); $server = mysql_real_escape_string($_POST["server_name"]); $date = explode("-", trim($_POST["ban_created"])); if ($reason == "" || $plnick == "" || $server == "" || $date == "" || sizeof($date) != 3) { $user_msg = "_NOREQUIREDFIELDS"; } else { $date = (int) strtotime($date[2] . $date[1] . $date[0]); $file = mysql_real_escape_string($_FILES['filename']['name']); $types = array("cfg", "txt"); if ($file == "") { $user_msg = "_FILENOFILE";