function restore_all() { $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); if ($pid < 100) { $pid = null; } if ($unix->process_exists($pid, basename(__FILE__))) { $timepid = $unix->PROCCESS_TIME_MIN($pid); ufdbguard_admin_events("Already executed pid {$pid} since {$timepid}", __FUNCTION__, __FILE__, __LINE__, "reports"); if ($GLOBALS["VERBOSE"]) { echo "Already executed pid {$pid}\n"; } return; } @file_put_contents($pidfile, getmypid()); $sock = new sockets(); $ArticaProxyStatisticsRestoreFolder = $sock->GET_INFO("ArticaProxyStatisticsRestoreFolder"); if ($ArticaProxyStatisticsRestoreFolder == null) { $ArticaProxyStatisticsRestoreFolder = "/home/artica/squid/backup-statistics-restore"; } if (!is_dir($ArticaProxyStatisticsRestoreFolder)) { ufdbguard_admin_events("{$ArticaProxyStatisticsRestoreFolder} no such directory", __FUNCTION__, __FILE__, __LINE__, "reports"); } $SUCC = 0; $FAI = 0; $t = time(); $files = $unix->DirFiles($ArticaProxyStatisticsRestoreFolder); while (list($srf, $line) = each($files)) { $fullfilename = "{$ArticaProxyStatisticsRestoreFolder}/{$srf}"; if (restore($fullfilename, true)) { $SUCC++; } else { $FAI++; } } $took = $unix->distanceOfTimeInWords($t, time(), true); ufdbguard_admin_events("{$SUCC} restored backup(s), {$FAI} failed, took {$took}", __FUNCTION__, __FILE__, __LINE__, "reports"); ScanDays(); }
$defines = PATH_ROOT . '/system/defines.php'; defined('TIMESTAMP') or define('TIMESTAMP', time()); $yii = PATH_ROOT . '/library/yii.php'; $config = PATH_ROOT . '/system/config/common.php'; $ibosApplication = PATH_ROOT . '/system/core/components/ICApplication.php'; require_once $defines; require_once $yii; require_once $ibosApplication; Yii::createApplication('ICApplication', $config); $op = EnvUtil::getRequest('op'); $msg = $url = ''; $type = 'message'; $success = 1; if ($op == 'restore') { $id = EnvUtil::getRequest('id'); $status = restore($id); extract($status); showMeassage($msg, $url, $type, $success); } else { if ($op == 'restorezip') { $id = EnvUtil::getRequest('id'); $status = restoreZip($id); extract($status); showMeassage($msg, $url, $type, $success); } } function showHeader() { ob_start(); $charset = CHARSET; $staticUrl = 'static';
#!/usr/bin/php <?php //exit; require_once 'config.php'; echo "{$hosts}"; $host = get_dbhost($hosts); $sag = new Sag($host, $dbport); function input() { $stdin = fopen('php://stdin', 'r'); $resp = fgetc($stdin); return $resp; } echo " HAVE YOU set config in hosts? !!!!!\n"; echo "brand_provisioner install file -> couchdb on {$hosts} (only 1)? Y/N "; $resp = input(); if ($resp == 'Y') { restore('brand_provisioner', 'DB_INSTALL/brand_provisioner/'); restore('system_config', 'DB_INSTALL/system_config/'); } echo "brand_provisioner restore from couchdb -> file ? Y/N "; $resp = input(); if ($resp == 'Y') { backup('brand_provisioner', 'DB_INSTALL/brand_provisioner/', false); backup('system_config', 'DB_INSTALL/system_config/', 'crossbar.devices'); } sleep(2);
} } } redirect(BASE_PATH . '/backup/?token=' . $_SESSION['token'], 1); } $error = true; if (validRequest()) { if (isset($_SESSION['login']) && $_SESSION['permission'] == 'admin') { if (isset($_GET['token']) && $_GET['token'] == $_SESSION['token']) { $error = false; $do = 'view'; if (isset($_GET['do']) && !empty($_GET['do'])) { $do = trim(strtolower($_GET['do'])); } switch ($do) { case 'view': view($pdo); break; case 'backup': backup($pdo); break; case 'restore': restore($pdo); break; } } } } if ($error) { redirect(BASE_PATH . '/index.php', 1); }
mysql_query("TRUNCATE TABLE t_jurusan"); mysql_query("TRUNCATE TABLE t_penddk"); mysql_query("TRUNCATE TABLE t_pkj"); mysql_query("TRUNCATE TABLE t_prestasi"); mysql_query("TRUNCATE TABLE t_sekolah"); mysql_query("TRUNCATE TABLE t_skolah"); $fileName = $_FILES['restore']['name']; //get the file name $fileSize = $_FILES['restore']['size']; //get the size $fileError = $_FILES['restore']['error']; $fileType = $_FILES['restore']['type']; $tipeFile = getEkstensiFile($fileName); if ($tipeFile == "sql") { $move = move_uploaded_file($_FILES['restore']['tmp_name'], 'temp/' . $fileName); $rest = restore("temp/" . $fileName); unlink("temp/" . $fileName); if (!$rest) { echo "<h4 class='alert_success'>Berhasil Restore<span id='close'>[<a href='#'>X</a>]</span></h4>"; } else { echo "<h4 class='alert_error'>Gagal Restore " . mysql_error() . "<span id='close'>[<a href='#'>X</a>]</span></h4>"; } } else { echo "<h4 class='alert_error'>Bukan File SQL. Tipe file Anda : <b>{$fileType}</b><span id='close'>[<a href='#'>X</a>]</span></h4>"; } } else { if ($mod == "backup") { $bck = backup_tables("*"); echo "<meta http-equiv='refresh' content='0; url= donload.php?filename={$bck}'>"; if ($bck) { echo "<h4 class='alert_success'>Berhasil Backup<span id='close'>[<a href='#'>X</a>]</span></h4>";
<?php include_once "../config.php"; include_once "views/views.php"; if ($operazione == "back") { $cubename_sel = $_POST['cubename']; $levels = unserialize(stripslashes($_POST['levels'])); restore($cubename_sel, $levels, $img_del); }
?> <div class="block"> <h2><span>Installation successful</span></h2> <div class="box"> <div class="inbox"> <p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title); ?> . See readme.txt for further instructions.</p> </div> </div> </div> <?php } else { // Run the restore function (defined above) restore(); ?> <div class="block"> <h2><span>Restore successful</span></h2> <div class="box"> <div class="inbox"> <p>Your database has been successfully restored.</p> </div> </div> </div> <?php } } else { ?> <div class="blockform"> <h2><span>Mod installation</span></h2>
} else { die("can't open file {$src} to restore"); return FALSE; } } return TRUE; } function open_restore_stream($src) { global $buffer_sql; global $charset; $in_file = $src; $fptr = @fopen($in_file, 'rb'); if ($fptr) { $buffer_sql = fread($fptr, filesize($in_file)); if ($charset != 'iso-8859-1') { $buffer_sql = iconv("ISO-8859-1", strtoupper($charset), $buffer_sql); $buffer_sql = preg_replace('/iso-8859-1/i', $charset, $buffer_sql); } fclose($fptr); return TRUE; } else { $buffer_sql = ''; return FALSE; } } if (restore("../../backup/backups/" . $_FILES['archive_file']['tmp_name'])) { print "<br />Upload done"; } else { print "<br />Should not happen"; }
// Perform the query if (mysql_query($templine)) { $berhasil++; } else { $gagal++; } // Reset temp variable to empty $templine = ''; } } if (file_exists($letak)) { unlink($letak); } echo "<script type=\"text/javascript\">alert('Hasil Restore Berhasil: {$berhasil} Gagal {$gagal}');</script>"; } if ($_GET["do"] == "backup") { backup_tables(); } if ($_GET["do"] == "restore") { $file = $_FILES['restore']['tmp_name']; restore($file); } get_kepala(); ?> <button class="btn btn-success" style="font-weight:bold; width: 100%; height: 50px; font-size: 24px" onclick="window.location='backup.php?do=backup'">Backup Database</button> <form action="backup.php?do=restore" method="post" enctype='multipart/form-data'> <input name="restore" type="file" style="font-weight:bold; width: 77%; height: 50px; font-size: 24px; margin: 5px 0;"> <input class="btn btn-primary" type='submit' value="Restore" style="font-weight:bold; width: 20%; height: 50px; font-size: 24px; float: right; margin: 5px 0"> </form> <?php get_kaki();
<div class="container"> <?php include '../main/connection.php'; //membuat nama file $file = $database . '_' . date("DdMY") . '.sql'; ?> <?php //Restore database ================================================ if (isset($_POST['restore'])) { restore($_FILES['datafile']); //echo "<pre>"; //print_r($lines); //echo "</pre>"; } else { unset($_POST['restore']); } ?> </div> <?php function restore($file) { global $rest_dir; $nama_file = $file['name']; $ukrn_file = $file['size'];
} else { print "<table width=\"100%\" height=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody>"; print "<tr><td height = \"25\" align=\"center\" valign=\"top\">"; print "<table width=\"100%\" align=\"center\" border=\"0\" cellspacing=\"2\" cellpadding=\"0\"><tbody>"; print "<td width=\"10%\" {$top_bund}><font face=\"Helvetica, Arial, sans-serif\" color=\"#000066\"><a href=\"{$returside}\" accesskey=L>Luk</a></td>"; print "<td width=\"80%\" {$top_bund}><font face=\"Helvetica, Arial, sans-serif\" color=\"#000066\">Indlæs sikkerhedskopi</td>"; print "<td width=\"10%\" {$top_bund}><font face=\"Helvetica, Arial, sans-serif\" color=\"#000066\"><br></td>"; print "</tbody></table>"; print "</td></tr>"; } if ($_POST) { if ($restore = if_isset($_POST['restore'])) { if ($restore == 'OK') { $backup_encode = if_isset($_POST['backup_encode']); $filnavn = $_POST['filnavn']; restore($filnavn, $backup_encode, $backup_dbtype); } else { unlink($filnavn); } exit; } $fejl = $_FILES['uploadedfile']['error']; if ($fejl) { switch ($fejl) { case 2: print "<BODY onLoad=\"javascript:alert('Filen er for stor - er det en SALDI-sikkerhedskopi?')\">"; } upload(); exit; } if (basename($_FILES['uploadedfile']['name'])) {
die; } $_GET["CMD_LINE"] = implode(' ', $argv); $_GET["RESTORE_DIR"] = false; if (preg_match("#--verbose#", $_GET["CMD_LINE"])) { $_GET["DEBUG"] = true; } if (preg_match("#--directory#", $_GET["CMD_LINE"])) { $_GET["RESTORE_DIR"] = true; } if ($argv[1] == null) { events("No id specified"); die; } if ($argv[1] == '--restore') { restore($argv[2], $argv[3], $argv[4]); die; } $id = $argv[1]; $sql = "SELECT * FROM dar_index where filekey='{$id}'"; $q = new mysql(); $ligne = @mysql_fetch_array($q->QUERY_SQL($sql, 'artica_backup')); $ressource = $ligne["mount_md5"]; $sourcefile = $ligne["filepath"]; $cmd = "/usr/share/artica-postfix/bin/artica-backup --dar-find \"{$ressource}\" \"{$sourcefile}\" >/usr/share/artica-postfix/ressources/logs/dar.find.{$id}.txt"; events($cmd); system($cmd); chmod("/usr/share/artica-postfix/ressources/logs/dar.find.{$id}.txt", 0755); function events($text) { $pid = getmypid();
<?php require_once dirname(__FILE__) . '/local/loc.init_public.php'; /*----------------------------------------------------------------------- POST hook -----------------------------------------------------------------------*/ if (isset($_POST['preview'])) { preview($_POST['table'], $_POST['backup_file'], $_POST['path']); } if (isset($_POST['restore'])) { restore($_POST['table'], $_POST['backup_file'], $_POST['path']); } if (isset($_POST['get_backup'])) { echo print_all_backup_file($_POST['table']); } /*----------------------------------------------------------------------- Return the list of field name in an array -----------------------------------------------------------------------*/ function print_table($table) { global $mysql; $sql = "SELECT * FROM {$table}"; $result = $mysql->sql_query($sql); $numFields = mysqli_num_fields($result); while ($data = mysqli_fetch_assoc($result)) { $cpt = 1; foreach ($data as $info) { $html .= $info; if ($cpt == $numFields) { $html .= '<br />'; } else {
#!/usr/bin/php <?php require_once 'config.php'; $host = get_dbhost($hosts); $sag = new Sag($host); function input() { $stdin = fopen('php://stdin', 'r'); $resp = fgetc($stdin); return $resp; } echo "HAVE YOU set config in hosts? !!!!!\n"; echo "servers install file -> couchdb on {$hosts} (only 1)? Y/N "; $resp = input(); if ($resp == 'Y') { restore('brand_provisioner', 'DB_INSTALL/'); } echo "servers restore from couchdb -> file ? Y/N "; $resp = input(); if ($resp == 'Y') { backup('brand_provisioner', 'DB_INSTALL/'); } sleep(2);
$value = addPrevision($json); } else { if (isset($_GET['saveCarry'])) { $value = saveCarry($json); } else { if (isset($_GET['edit']) && isset($_GET['isNumeric'])) { $value = editDispatchPrevisionNumberField($json, $_GET['edit']); } else { if (isset($_GET['edit'])) { $value = editDispatchPrevisionField($json, $_GET['edit']); } else { if (isset($_GET['updatePrevisionCarry'])) { $value = updateDispatchPrevisionCarry($json); } else { if (isset($_GET['archive'])) { $value = archive($json); } else { if (isset($_GET['restore'])) { $value = restore($json); } else { $value = saveDispatch($json); } } } } } } } //return JSON array exit(json_encode($value)); }
<?php ini_set('display_errors', 1); ini_set('html_errors', 0); ini_set('display_errors', 1); ini_set('error_reporting', E_ALL); include_once dirname(__FILE__) . '/framework/frame.class.inc'; include_once dirname(__FILE__) . "/framework/class.unix.inc"; include_once dirname(__FILE__) . "/framework/class.settings.inc"; include_once dirname(__FILE__) . "/ressources/class.mysql.inc"; restore($argv[1]); function build_progress($text, $pourc) { $array["POURC"] = $pourc; $array["TEXT"] = $text; if (is_numeric($text)) { $array["POURC"] = $text; $array["TEXT"] = $pourc; } if ($GLOBALS["VERBOSE"]) { echo "******************** {$pourc}% {$text} ********************\n"; } $GLOBALS["CACHEFILE"] = "/usr/share/artica-postfix/ressources/logs/web/squid.articadb.restore.progress"; @file_put_contents($GLOBALS["CACHEFILE"], serialize($array)); @chmod($GLOBALS["CACHEFILE"], 0755); } function restore($filename) { $unix = new unix(); $sock = new sockets(); $TMP = $unix->FILE_TEMP();
case 'chambery': if (restore("{$lang}/indexint_chambery.sql")) { print $msg_crea_23; } else { print $msg_crea_24; } break; case 'dewey': if (restore("{$lang}/indexint_dewey.sql")) { print $msg_crea_25; } else { print $msg_crea_26; } break; case 'marguerite': if (restore("{$lang}/indexint_100.sql")) { print $msg_crea_27; } else { $msg_crea_28; } $rqt = "update parametres set valeur_param='0' where type_param='opac' and sstype_param='show_100cases_browser' "; $result = pmb_mysql_query($rqt, $link); $rqt = "update parametres set valeur_param='1' where type_param='opac' and sstype_param='show_marguerite_browser' "; $result = pmb_mysql_query($rqt, $link); $rqt = "update parametres set valeur_param='0' where type_param='opac' and sstype_param='show_categ_browser' "; $result = pmb_mysql_query($rqt, $link); break; case 'aucun': print $msg_crea_29; break; }
#!/usr/bin/php <?php require_once 'config.php'; require_once 'phplib/Sag.php'; require_once 'setup_functions.php'; require_once 'functions.php'; $host = get_dbhost($hosts); $sag = new Sag($host); function input() { $stdin = fopen('php://stdin', 'r'); $resp = fgetc($stdin); return $resp; } echo "HAVE YOU set config in hosts? !!!!!\n"; echo "system_config/crossbar.phone_numbers install file -> couchdb on {$hosts} (only 1)? Y/N "; $resp = input(); if ($resp == 'Y') { restore('system_config', 'DB_INSTALL/system_config/', 'update'); } echo "system_config/crossbar.phone_numbers restore from couchdb -> file ? Y/N "; $resp = input(); if ($resp == 'Y') { backup('system_config', 'DB_INSTALL/system_config/', 'crossbar.phone_numbers'); } sleep(2);
</div> </form> </div> <br /> </body> </html> <?php if (isset($_POST['restore'])) { $kdskpd = $this->session->userdata('kdskpd'); $sql = "select nm_skpd from ms_skpd where kd_skpd='{$kdskpd}'"; $query = $this->db->query($sql); $hasil = $query->row(); $nm_skpd = $hasil->nm_skpd; restore($_FILES['datafile'], $kdskpd, $nm_skpd); } else { unset($_POST['restore']); } ?> </div> <?php function restore($file, $kode, $nama) { $nama_file = $file['name']; $ukrn_file = $file['size']; $tmp_file = $file['tmp_name']; if ($nama_file == "") { echo '<center><font size="4" color="#FF0000">PERINGATAN !</font></center>'; echo '<center><font size="4" color="#FF0000">" File Masih Kosong "</font></center>';
if (preg_match("#--force#", implode(" ", $argv))) { $GLOBALS["FORCE"] = true; } if (posix_getuid() != 0) { die("Cannot be used in web server mode\n\n"); } include_once dirname(__FILE__) . '/framework/class.unix.inc'; include_once dirname(__FILE__) . "/framework/frame.class.inc"; include_once dirname(__FILE__) . '/ressources/class.os.system.inc'; include_once dirname(__FILE__) . '/ressources/class.mysql.inc'; include_once dirname(__FILE__) . '/ressources/class.system.network.inc'; include_once dirname(__FILE__) . "/framework/class.settings.inc"; include_once dirname(__FILE__) . "/ressources/class.mysql.syslog.inc"; include_once dirname(__FILE__) . "/ressources/class.mysql.syslogs.inc"; if ($argv[1] == "--restore") { echo restore($argv[2], $argv[3]); return; } function restore($filename, $storeid) { $filename = trim($filename); $unix = new unix(); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".{$filename}.pid"; $pid = @file_get_contents("{$pidfile}"); if ($unix->process_exists($pid, basename(__FILE__))) { die; } @file_put_contents($pidfile, getmypid()); $EnableSyslogDB = @file_get_contents("/etc/artica-postfix/settings/Daemons/EnableSyslogDB"); if (!is_numeric($EnableSyslogDB)) { $EnableSyslogDB = 0;
case "upload-bank": if ($v) { uploadBank($r['data']); } else { echoUploadBankForm(); } break; case "stat-bank": echoBankStats(); break; case "backup": backup(); break; case "restore": if ($v) { restore($r['data']); } else { restoreForm(); } break; case "drop-results": if ($v && $r['submit'] == "ja") { query("delete from " . ZUG); query("delete from " . RES); echo "ergebnisse gelöscht"; } else { if ($v) { include STATIC_DIR . "admin-welcome"; } else { areyousure("?drop-results=true", "ergebnisse löschen", "achtung! alle ergebnisdaten werden dabei gelöscht! NUR NACH ENDE DER TESTPHASE AKTIVIEREN, IN KEINEM FALL WÄHREN DEM BETRIEB!"); }
deletedata($option, $rcid); break; case 'sample': addSampleData($option); break; case 'saveorder': saveOrder($cid); break; case 'saveRegistration': saveRegistration($option); break; case 'backup': backup(); break; case 'restore': restore($option); break; case 'restoreprocess': restoreProcess($option); break; case 'forms.copy': formsCopy($option, $cid); break; case 'fields.copy.screen': fieldsCopyScreen($option, $cid); break; case 'fields.copy.cancel': fieldsCopyCancel($option); break; case 'fields.copy': fieldsCopy($option, $cid);