本文整理汇总了PHP中backup函数的典型用法代码示例。如果您正苦于以下问题:PHP backup函数的具体用法?PHP backup怎么用?PHP backup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了backup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: install
function install($db, $udb, $fname, $dbinfo)
{
mysql_select_db($udb, $db);
if (!backup($dbinfo)) {
printf("Backup failed. Cowardly refusing to continue.<br><a href='?typ=forms'>Return</a>");
return;
}
// Load the file into a variable, it gets loaded as an array
//$mytxt = file(dirname(__FILE__) . '/' . 'sqlsetup/setupWSE' . '.sql');
//$mytxt = file(dirname(__FILE__) . '/' . $fname . '.sql');
$mytxt = file(dirname(__FILE__) . '/' . $fname);
$current_statement = "";
// Loop through the array, reassemble the statements
foreach ($mytxt as $count => $line) {
// Remove the -- comments
if (substr(trim($line), 0, 2) != '#') {
$current_statement .= "\n" . rtrim($line);
}
// This marks the end of an SQL statement
if (preg_match('~;[\\s]*$~s', $line) == 1) {
if ($_GET["opt"] != "supress") {
printf("Executing: <b>" . $current_statement . "</b><br>");
} else {
printf("Executing: <b>" . htmlspecialchars($current_statement) . "</b><br>");
}
// Attempt to execute the statement
if (!mysql_query($current_statement)) {
printf("Error: " . mysql_error($db) . "<br>");
}
// Reset the statement to blank, to build the next one.
$current_statement = "";
printf("<br>");
}
}
printf("Installation finished.<br><a href='?typ=forms'>Return</a>");
}
开发者ID:pietersartain,项目名称:webtools,代码行数:36,代码来源:install.php
示例2: 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);
开发者ID:urueedi,项目名称:kazoo-provision,代码行数:27,代码来源:setup.php
示例3: backup
<?php
require 'functions.php';
backup('/work/htdocs/switch-dev.adsage.tk/1', 'test1.zip');
开发者ID:zeus911,项目名称:versionSwitchTool,代码行数:4,代码来源:test.php
示例4: back_base_init
* User: apple
* Date: 15/10/27
* Time: 下午11:15
*/
include 'library/init.inc.php';
back_base_init();
$template = 'backup/';
assign('subTitle', '数据备份');
$action = 'edit|add|view|delete';
$operation = 'backup';
$act = check_action($action, getGET('act'));
$act = $act == '' ? 'view' : $act;
$opera = check_action($operation, getPOST('opera'));
if ('backup' == $opera) {
$respone = array('error' => 1, 'msg' => '');
$file = backup();
if ($file) {
$response['error'] = 0;
$response['msg'] = '备份成功<a href="' . $file . '">备份文件</a>';
show_system_message('备份成功');
} else {
$response['msg'] = '系统繁忙,请稍后再试';
show_system_message($response['msg']);
}
echo json_encode($response);
exit;
}
$files = array();
$dir = dir('backup');
$pattern = '/db-backup-\\d+/';
while ($path = $dir->read()) {
开发者ID:Winsen1990,项目名称:direct-sale,代码行数:31,代码来源:backup.php
示例5: 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);
}
开发者ID:parsinegar2015,项目名称:parsinegar,代码行数:31,代码来源:backup.php
示例6: date
<?php
include '../../main/connection.php';
//membuat nama file
$file = $database . '_' . date("DdMY") . '.sql';
backup($file);
$file = $back_dir . $file;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=' . basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: private');
header('Pragma: private');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
} else {
echo "file {$file} sudah tidak ada.";
}
function backup($nama_file, $tables = '')
{
global $return, $tables, $back_dir, $database;
if ($tables == '') {
$tables = array();
$result = @mysql_list_tables($database);
while ($row = @mysql_fetch_row($result)) {
$tables[] = $row[0];
开发者ID:Zame31,项目名称:SeminarProject,代码行数:31,代码来源:backup.php
示例7: _backUp
/**
* Updater::_backUp()
*
* @return
*/
private function _backUp()
{
$this->parent->parent->debug($this::name_space . ': Backing up module dir...');
// Create the temp dir path
$tempDir = __TEMP__ . '/' . strtolower($this->module_ns) . '.bak';
// Now if the directory already exists, remove it
if (file_exists($tempDir) && is_dir($tempDir)) {
WebApp::rmDir($tempDir);
}
// (Re)create the temp dir
mkdir($tempDir);
// Now we copy the module files to the payload dir
if (rcopy($this->module_dir, $tempDir . '/payload')) {
// Copy the module.xml as we'll need it for restoration
rename($tempDir . '/payload/module.xml', $tempDir . '/module.xml');
$this->parent->parent->debug($this::name_space . ': Copied module to __TEMP__/"' . strtolower($this->module_ns) . '.bak"!');
// If the module specified the backup flag when installed, we can now run the backup() function for it
if ($this->backup) {
@(include $this->module_dir . '/backup.php');
if (is_callable('backup')) {
backup();
} else {
$this->parent->parent->debug($this::name_space . ': Couldn\\t find backup()!');
}
}
// With that done, we can move onto the next step
return new ActionResult($this, '/admin/modules/update/', 0, 'Updating module files...', B_T_SUCCESS, array('step' => 3, 'status' => 1, 'msg' => 'Updating module files...'));
} else {
// if(rcopy($this->module_dir, $tempDir.'/payload'))
// Yup, couldn't back it up
$this->parent->parent->debug($this::name_space . ': Failed to backup module!');
}
// Return generic couldn't back up the module
return new ActionResult($this, '/admin/modules/update/', 0, 'Failed to back up the module!', B_T_FAIL, array('status' => 0, 'msg' => 'Failed to back up the module!'));
}
开发者ID:huwcbjones,项目名称:WebFramework,代码行数:40,代码来源:update.php
示例8: restore_id
function restore_id($storeid)
{
$unix = new unix();
$pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".{$storeid}.pid";
$pid = @file_get_contents("{$pidfile}");
if ($unix->process_exists($pid, basename(__FILE__))) {
events("Process {$pid} already exists...aborting");
die;
}
@file_put_contents($pidfile, getmypid());
include_once dirname(__FILE__) . "/ressources/class.mysql.syslogs.inc";
$sock = new sockets();
$SargOutputDir = $sock->GET_INFO("SargOutputDir");
if ($SargOutputDir == null) {
$SargOutputDir = "/var/www/html/squid-reports";
}
$sarg_bin = $unix->find_program("sarg");
if (!is_file($sarg_bin)) {
sarg_admin_events("Fatal, unable to locate sarg binary, aborting...", __FUNCTION__, __FILE__, __LINE__, "sarg");
return;
}
$bzip2 = $unix->find_program("bzip2");
$gunzip = $unix->find_program("gunzip");
$TempDir = "/home/artica-extract-temp";
@mkdir($TempDir, 0777);
@chown($TempDir, "mysql");
@chdir($TempDir, "mysql");
if (!is_file("/etc/squid3/sarg.conf")) {
buildconf();
}
$q = new mysql_storelogs();
$ligne = @mysql_fetch_array($q->QUERY_SQL("SELECT filename FROM files_info WHERE storeid='{$storeid}'"));
$filename = $ligne["filename"];
events("Extracting infos from {$filename}");
$EnableSyslogDB = @file_get_contents("/etc/artica-postfix/settings/Daemons/EnableSyslogDB");
if (!is_numeric($EnableSyslogDB)) {
$EnableSyslogDB = 0;
}
if ($EnableSyslogDB == 0) {
events("Extracting infos from {$filename} failed, SyslogDB is not enabled");
return;
}
$q = new mysql_storelogs();
$sql = "SELECT filecontent INTO DUMPFILE '{$TempDir}/{$filename}' FROM files_store WHERE ID = '{$storeid}'";
$q->QUERY_SQL($sql);
if (!$q->ok) {
events("Failed!!! {$q->mysql_error}", 100);
return;
}
$file_extension = file_extension($filename);
progress("Extract {$filename} extension: {$file_extension}", 5);
$newtFile = $filename . ".log";
if ($file_extension == "bz2") {
$cmdline = "{$bzip2} -d \"{$TempDir}/{$filename}\" -c >\"{$TempDir}/{$newtFile}.log\" 2>&1";
exec($cmdline, $results);
}
if ($file_extension == "gz") {
$cmdline = "{$gunzip} -d \"{$TempDir}/{$filename}\" -c >\"{$TempDir}/{$newtFile}.log\" 2>&1";
}
if ($cmdline != null) {
exec($cmdline, $results);
progress("Extract done " . @implode(" ", $results), 7);
} else {
if (!@copy("{$TempDir}/{$filename}", "{$TempDir}/{$newtFile}.log")) {
progress("Failed!!! Copy error", 100);
return;
}
}
@unlink("{$TempDir}/{$filename}");
if (!is_file("{$TempDir}/{$newtFile}.log")) {
progress("Failed!!! {$TempDir}/{$newtFile}.log error no such file", 100);
return;
}
$t = time();
sargToFile("{$TempDir}/{$newtFile}.log");
progress("{$filename} ({$storeid}) done " . $unix->distanceOfTimeInWords($t, time()));
backup();
}
开发者ID:brucewu16899,项目名称:1.6.x,代码行数:78,代码来源:exec.sarg.php
示例9: get_dbhost
#!/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);
开发者ID:urueedi,项目名称:kazoo-regextern,代码行数:26,代码来源:setup.php
示例10: date
<form action="" method="post" name="postform" >
<div class="asd">
<label for="backup"><h2><b>Backup Database</b></h2></label>
<br>
<input type="submit" name="backup" value="Proses Backup" />
</form>
</center>
<?php
include "backup.php";
$database = 'Backup';
$file = $database . '_' . date("D, d-M-Y") . '_' . time() . '.sql';
//Backup database
if (isset($_POST['backup'])) {
// Backup Semua Tabel
backup("localhost", "root", "", "klinik", $file, "*");
// Backup Hanya Tabel Tertentu
//backup("localhost","user_database","pass_database","nama_database",$file,"tabel1,tabel2,tabel3");
echo 'Backup database telah selesai <a style="cursor:pointer" href="?nama_file=' . $file . '" title="Download">Download file database</a>';
echo "<pre>";
echo "</pre>";
} else {
unset($_POST['backup']);
}
?>
</td>
</td>
<td><br>
<center><h3><font size="6">Daftar Pasien Tanggal
开发者ID:novitasa,项目名称:clinic,代码行数:31,代码来源:adminByDate.php
示例11: pageBackup
/**
* Display the 'Backup' page.
*/
function pageBackup()
{
global $PIVOTX;
// check if the user has the required userlevel to view this page.
$PIVOTX['session']->minLevel(PIVOTX_UL_NORMAL);
$PIVOTX['template']->assign('title', __('Backup'));
$PIVOTX['template']->assign('heading', __('Download a zip file containing your configuration files, templates or entries database'));
$form_backup_cfg = getBackupCfgForm();
$form_backup_templates = getBackupTemplatesForm();
$form_backup_database = getBackupDatabaseForm();
$form_html = $form_backup_cfg->fetch() . $form_backup_templates->fetch() . $form_backup_database->fetch();
if ($PIVOTX['config']->get('db_model') == "flat") {
$form_backup_entries = getBackupEntriesForm();
$form_html .= $form_backup_entries->fetch();
} else {
$form_html .= '<p>' . __('NB! Backup the (entries) database using your ISP control panel or the command line.') . '</p>';
}
// Which form is used below is irrelevant.
if ($form_backup_cfg->validate() == FORM_OK) {
$val = $form_backup_cfg->getvalues();
if ($val['what'] == 'config' || $val['what'] == 'entries' || $val['what'] == 'templates' || $val['what'] == 'db-directory') {
backup($val['what']);
// The script stops here - the backup starts the download.
} else {
debug("Unknown page action");
return;
}
}
$PIVOTX['template']->assign("form", $form_html);
$PIVOTX['template']->assign("html", $html);
renderTemplate('generic.tpl');
}
开发者ID:laiello,项目名称:pivotx-sqlite,代码行数:35,代码来源:pages.php
示例12: publish
function publish($siteid, $version, $description, $filename, $md5, $type)
{
global $cfg, $data, $versions, $ext;
$rt = array('result' => false, 'error' => -1);
$debug = '1';
$list = getList(false);
$site = $list[$siteid];
//$debug= json_encode($site);
//$debug = $description;
//file_put_contents("debug.log", strtolower(md5_file($filename)))
//file_put_contents("debug.log", strtolower(md5_file($filename)))
if ($site != null && file_exists($filename) && strtolower(md5_file($filename)) == strtolower(trim($md5))) {
if ($site['current_version'] == $version) {
//10 publish 发布版本和线上版本一致
$rt['error'] = 10;
return $rt;
}
//检查目标路径
$p = $site['root'] . $version;
$tmp = $cfg['tmp_unzip'] . getRandomName($siteid . '_' . $version . '_tmp/');
if (file_exists($p)) {
//如果存在则备份配置
//删除已经存在的文件目录
if ($site['backup']) {
backup($p, $site['backup'] . getRandomName($siteid . '_' . $version . '.zip'));
}
$r = delDirAndFile($p);
if ($r == 0) {
$debug = $p;
//9 publish 目录创建失败
$rt['error'] = 9;
}
}
if ($site['upload']) {
//备份上传文件
copy($filename, $site['upload'] . str_replace($cfg['tmp_upload'], '', $filename));
}
if ($rt['error'] == -1) {
if (!mkdir($p) || !mkdir($tmp)) {
//9 publish 目录创建失败
$debug = $p . ' ' . $tmp;
$rt['error'] = 9;
} else {
if ($type && strtolower($type) == 'copyreplace') {
//拷贝当前版本
FileUtil::copyDir($site['root'] . $site['current_version'], $p, true);
}
//解压缩文件到临时目录
$z = new ZipArchive();
//die(file_exists($filename));
$z->open($filename);
$z->extractTo($tmp);
//将临时目录下的deploy目录拷贝到目标路径
if (file_exists($tmp . 'deploy')) {
//将部署程序从deploy目录下拷贝到目标路径
FileUtil::copyDir($tmp . 'deploy', $p, true);
if ($versions[$siteid] == null) {
$versions[$siteid] = array();
}
$intver = intval($version);
$versions[$siteid][$intver] = array('version' => $intver, 'description' => $description, 'date' => date("Y-m-d H:i:s", time()));
save_records($data, $ext, $versions);
$rt['error'] = 0;
$rt['result'] = true;
} else {
$rt['error'] = 7;
$debug = '上传文件无deploy目录';
}
//删除临时目录
/*
FileUtil::unlinkFile($filename);
FileUtil::unlinkDir($tmp);
*/
}
}
} else {
//8 publish upload md5 校验失败
$rt['error'] = 8;
}
$rt['msg'] = $debug;
return $rt;
}
开发者ID:zeus911,项目名称:versionSwitchTool,代码行数:82,代码来源:index.php
示例13: date
$log .= date('Y-m-d H:i:s') . "已成功存储到云端" . $ret['filename'] . "\r\n";
} else {
$log .= date('Y-m-d H:i:s') . "存储到云端失败" . $ret['filename'] . "\r\n";
}
unlink('./' . $ret['filename']);
break;
case '2':
//仅本地
$log .= date('Y-m-d H:i:s') . "已存储到本地" . $ret['filename'] . "\r\n";
break;
case '3':
///云端和本地
$log .= date('Y-m-d H:i:s') . "已存储到本地" . $ret['filename'] . "\r\n";
$sendok = $file::sendfile($ret['filename']);
if ($sendok) {
$log .= date('Y-m-d H:i:s') . "已成功存储到云端" . $ret['filename'] . "\r\n";
} else {
$log .= date('Y-m-d H:i:s') . "存储到云端失败" . $ret['filename'] . "\r\n";
}
break;
default:
$log .= "备份参数不正确\r\n";
break;
}
return $log;
}
if ($_GET['key'] == PASS) {
$log = backup();
echo $log;
file_put_contents('log.log', $log, FILE_APPEND);
}
开发者ID:joyerma,项目名称:backup,代码行数:31,代码来源:backup.php
示例14: outputToJSON
if (empty($newData) || $newData == '[]') {
outputToJSON(array('error' => true, 'desc' => 'will not erase'));
}
//actual query
$params = array(':data' => $newData, ':datetime' => date("Y-m-d H:i:s"));
$query = "UPDATE vaultage_data SET\r\n\t\t\t\t\t\t\t`last_update` =:datetime,\r\n\t\t\t\t\t\t\t`data` =:data";
$req = $db->prepare($query);
$res = $req->execute($params);
}
/*
* This will send a backup by mail if the option is enabled
*/
function backup($data)
{
if (MAIL_BACKUP_ENABLED) {
$header = "From: \"JWHITE-SERVER\"<[email protected]>\n";
$header .= "MIME-Version: 1.0\n";
$corpus = "" . $data . "\n\n[EOF]\n";
$res = mail(BACKUP_EMAIL, BACKUP_SUBJECT, $corpus, $header);
}
}
//main
auth();
$db = dbSetup();
$data = getLastCipher($db);
if (isset($_POST['data'])) {
writeNewCipher($db, $_POST['data']);
$data = getLastCipher($db);
backup($data[0][0]);
}
outputToJSON(array('error' => false, 'data' => $data[0][0]));
开发者ID:Software-js,项目名称:Passwords,代码行数:31,代码来源:core.php
示例15: header
#
#
#
#
#
#
#
#
require "settings.php";
header("Location: company-export.php");
exit;
# decide what to do
if (isset($_POST["key"])) {
switch ($_POST["key"]) {
case "backup":
$OUTPUT = backup($_POST);
break;
default:
$OUTPUT = comfirm();
}
} else {
$OUTPUT = confirm();
}
require "template.php";
# confirms
function confirm()
{
$confirm = "<h3>Making a new Backup will delete the previous backup.</h3>\r\n<br>\r\n<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n<form action='" . SELF . "' method=post>\r\n<input type=hidden name=key value=backup>\r\n\r\n<tr><td colspan=2 align=right><input type=submit value='Backup »'></td></tr>\r\n</form>\r\n</table> <p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Quick Links</th></tr>\r\n <script>document.write(getQuicklinkSpecial());</script>\r\n <tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>\r\n";
return $confirm;
}
# Select Month
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:31,代码来源:backup-make.php
示例16: session_start
<?php
require_once "config/dbconf.php";
session_start();
global $config;
$pdo = new PDO($config['host'], $config['user'], $config['password']);
$r = backup($pdo);
if (!isset($_SESSION['user'])) {
save($pdo);
header("Location: /login.php");
exit;
}
board($pdo);
if (isset($_POST['reset_best'])) {
unset($_SESSION['best_score']);
best($pdo);
}
if (empty($_SESSION['choice']) || isset($_POST['reset'])) {
$choice = rand(0, 100);
$_SESSION['score'] = 0;
$_SESSION['choice'] = $choice;
$_SESSION['response'] = null;
save($pdo);
} else {
$choice = $_SESSION['choice'];
$_SESSION['score'] = $r['save_score'];
$_SESSION['choice'] = $r['save_number'];
$_SESSION['response'] = $r['save_response'];
$_SESSION['guess'] = $r['save_guess'];
}
if (empty($_POST['guess'])) {
开发者ID:lulus75,项目名称:LAMP_1,代码行数:31,代码来源:index.php
示例17: restorembx
function restorembx($basedContent)
{
$GLOBALS["ONNLY_MOUNT"] = true;
$unix = new unix();
$rsync = $unix->find_program("rsync");
$chown = $unix->find_program("chown");
$sudo = $unix->find_program("sudo");
$reconstruct = $unix->LOCATE_CYRRECONSTRUCT();
if (!is_file($rsync)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat rsync program", __FUNCTION__, __FILE__, __LINE__);
return;
}
if (!is_file($reconstruct)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat reconstruct program", __FUNCTION__, __FILE__, __LINE__);
return;
}
$array = unserialize(base64_decode($basedContent));
$id = $array["taskid"];
writelogs(date('m-d H:i:s') . " " . "mounting {$id}", __FUNCTION__, __FILE__);
$mounted_dir = backup($id);
if ($mounted_dir == null) {
writelogs(date('m-d H:i:s') . " " . "cannot mount task id {$id}", __FUNCTION__, __FILE__);
return;
}
$path = $array["path"];
$uid = $array["uid"];
if (preg_match("#INBOX\\/(.+)#", $array["mailbox"], $re)) {
$mailbox = $re[1];
$cyrus = new cyrus();
$cyrus->CreateSubDir($uid, $mailbox);
} else {
$mailbox = $array["mailbox"];
}
$localimapdir = $unix->IMAPD_GET("partition-default");
if (!is_dir($localimapdir)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat local partition-default", __FUNCTION__, __FILE__, __LINE__);
return;
}
$userfs = str_replace(".", "^", $uid);
$firstletter = substr($userfs, 0, 1);
$localuserfs = "{$localimapdir}/{$firstletter}/user/{$userfs}";
$localimapdir = "{$localimapdir}/{$firstletter}/user/{$userfs}/";
if (!is_dir($localimapdir)) {
writelogs(date('m-d H:i:s') . " " . "Unable to stat local \"{$localimapdir}\"", __FUNCTION__, __FILE__, __LINE__);
return;
}
$remoteimapdir = "{$mounted_dir}/{$path}/{$mailbox}";
@mkdir($localimapdir, null, true);
if (substr($remoteimapdir, strlen($remoteimapdir) - 1, 1) != "/") {
$remoteimapdir = $remoteimapdir . "/";
}
$cmd = "{$rsync} -z --stats {$remoteimapdir}* {$localimapdir} 2>&1";
if ($GLOBALS["USE_RSYNC"]) {
$backup = new backup_protocols();
writelogs(date('m-d H:i:s') . " " . "Using rsync protocol", __FUNCTION__, __FILE__, __LINE__);
$array_config = $backup->extract_rsync_protocol($remoteimapdir);
if (!is_array($array)) {
writelogs(date('m-d H:i:s') . " " . "[TASK {$ID}]: rsync protocol error", __FUNCTION__, __FILE__, __LINE__);
return false;
}
if ($array_config["PASSWORD"] != null) {
$tmpstr = "/opt/artica/passwords/" . md5($array_config["PASSWORD"]);
@mkdir("/opt/artica/passwords", null, true);
@file_put_contents($tmpstr, $array_config["PASSWORD"]);
$pwd = " --password-file={$tmpstr}";
}
if ($array["USER"] != null) {
$user = "{$array["USER"]}@";
}
$cmd = "{$rsync}{$pwd} --stats rsync://{$user}{$array_config["SERVER"]}/{$array_config["FOLDER"]}* {$localimapdir} 2>&1";
}
writelogs(date('m-d H:i:s') . " " . "Restore from {$remoteimapdir}", __FUNCTION__, __FILE__, __LINE__);
writelogs(date('m-d H:i:s') . " " . "Restore to {$localimapdir}", __FUNCTION__, __FILE__, __LINE__);
writelogs(date('m-d H:i:s') . " " . "reconstruct path {$reconstruct}", __FUNCTION__, __FILE__, __LINE__);
writelogs(date('m-d H:i:s') . " " . "{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $rsynclogs);
$i = 0;
while (list($num, $line) = each($rsynclogs)) {
if (preg_match("#Number of files transferred:\\s+([0-9]+)#", $line, $re)) {
$GLOBALS["events"][] = "Files restored: {$re[1]}";
}
if (preg_match("#Total transferred file size:\\s+([0-9]+)#", $line, $re)) {
$bytes = $re[1];
$re[1] = round($re[1] / 1024 / 1000) . "M";
$GLOBALS["events"][] = "{$re[1]} size restored ({$bytes} bytes)";
}
if (preg_match("#Permission denied#", $line)) {
$i = $i + 1;
}
}
$GLOBALS["events"][] = "{$i} file(s) on error";
shell_exec("{$chown} -R cyrus:mail {$localuserfs}");
shell_exec("/bin/chmod -R 755 {$localuserfs}");
$cmd = "{$sudo} -u cyrus {$reconstruct} -r -f user/{$uid} 2>&1";
writelogs(date('m-d H:i:s') . " " . "{$cmd}", __FUNCTION__, __FILE__, __LINE__);
exec($cmd, $rsynclogs);
$GLOBALS["events"][] = "Reconstruct information: ";
while (list($num, $line) = each($rsynclogs)) {
$GLOBALS["events"][] = "reconstructed path: {$line}";
}
//.........这里部分代码省略.........
开发者ID:articatech,项目名称:artica,代码行数:101,代码来源:exec.backup.php
示例18: installation
function installation()
{
$source = "update/Hargassner-master";
$dest = ".";
if (copyr($source, $dest)) {
echo "Installation OK<br>";
} else {
echo "Erreur d'installation : annulation de l'installation";
}
}
/************enchainement des actions **************************/
if (!is_dir("update")) {
mkdir("update");
}
if (!is_dir("update/backup")) {
mkdir("update/backup");
}
unlinkRecursive("update/Hargassner-master", true);
unlink("update/master.zip");
if (download($github)) {
if (unzip()) {
if (purge()) {
if (backup()) {
installation();
}
}
}
}
echo '<a href="index.php">Recharger le site</a> ';
?>
开发者ID:Jahislove,项目名称:Hargassner,代码行数:30,代码来源:auto-install.php
示例19: install
exit;
}
if (isset($_GET["install"])) {
install();
exit;
}
if (isset($_GET["installv1"])) {
installv1();
exit;
}
if (isset($_GET["InfluxDBPassword"])) {
InfluxDBPassword();
exit;
}
if (isset($_GET["backup"])) {
backup();
exit;
}
if (isset($_GET["restart-progress"])) {
restart_progress();
exit;
}
if (isset($_GET["version"])) {
version();
exit;
}
if (isset($_GET["move-restore"])) {
move_restore();
exit;
}
if (isset($_GET["restore-scandir"])) {
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:31,代码来源:influx.php
示例20: 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);
开发者ID:urueedi,项目名称:kazoo-daemon,代码行数:23,代码来源:setup.php
注:本文中的backup函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论