本文整理汇总了PHP中restore函数的典型用法代码示例。如果您正苦于以下问题:PHP restore函数的具体用法?PHP restore怎么用?PHP restore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了restore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: restore_all
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();
}
示例2: defined
$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';
示例3: get_dbhost
#!/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);
示例4: redirect
}
}
}
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);
}
示例5: mysql_query
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>";
示例6: unserialize
<?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);
}
示例7: pun_htmlspecialchars
?>
<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>
示例8: die
} 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";
}
示例9: unlink
// 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();
示例10: date
<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'];
示例11: if_isset
} 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'])) {
示例12: implode
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();
示例13: dirname
<?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 {
示例14: get_dbhost
#!/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);
示例15: addPrevision
$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));
}