本文整理汇总了PHP中backupbuddy_core::deploymentImportBuddy方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::deploymentImportBuddy方法的具体用法?PHP backupbuddy_core::deploymentImportBuddy怎么用?PHP backupbuddy_core::deploymentImportBuddy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::deploymentImportBuddy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deploy_pull_renderImportBuddy
public function deploy_pull_renderImportBuddy($state)
{
if (!file_exists($state['pullLocalArchiveFile'])) {
pb_backupbuddy::status('error', 'Error #32783732: Backup file `' . $state['pullLocalArchiveFile'] . '` not found.');
return false;
}
$backupSerial = backupbuddy_core::get_serial_from_file($state['pullLocalArchiveFile']);
$importbuddyPassword = md5(md5($state['destination']['key_public']));
$siteurl = site_url();
$additionalStateInfo = array();
$importFileSerial = backupbuddy_core::deploymentImportBuddy($importbuddyPassword, $state['pullLocalArchiveFile'], $additionalStateInfo);
if (is_array($importFileSerial)) {
// Could not generate importbuddy file.
return false;
}
// Store this serial in settings to cleanup any temp db tables in the future with this serial with periodic cleanup.
pb_backupbuddy::$options['rollback_cleanups'][$backupSerial] = time();
pb_backupbuddy::save();
// Create undo file.
$undoFile = 'backupbuddy_deploy_undo-' . $backupSerial . '.php';
if (false === copy(pb_backupbuddy::plugin_path() . '/classes/_rollback_undo.php', ABSPATH . $undoFile)) {
$error = 'Error #3289447: Unable to write undo file `' . ABSPATH . $undoFile . '`. Check permissions on directory.';
pb_backupbuddy::status('error', $error);
return false;
}
// Start pulling importbuddy log.
$importbuddyURLRoot = $siteurl . '/importbuddy-' . $importFileSerial . '.php';
$importbuddyLogURL = $importbuddyURLRoot . '?ajax=getDeployLog&v=' . $importbuddyPassword . '&deploy=true';
//$state['destination']['siteurl'] . '/importbuddy/'?ajax=2&v=' . $importbuddyPassword . '&deploy=true; //status-' . $response['importFileSerial'] . '.txt';
$importbuddyURL = $importbuddyURLRoot . '?ajax=2&v=' . $importbuddyPassword . '&deploy=true&direction=pull&file=' . basename($state['pullLocalArchiveFile']);
pb_backupbuddy::status('details', 'Load importbuddy at `' . $importbuddyURLRoot . '` with verifier `' . $importbuddyPassword . '`.');
pb_backupbuddy::status('loadImportBuddy', json_encode(array('url' => $importbuddyURL, 'logurl' => $importbuddyLogURL)));
// Calculate undo URL.
$undoDeployURL = $siteurl . '/backupbuddy_deploy_undo-' . $this->_backup['serial'] . '.php';
pb_backupbuddy::status('details', 'To undo deployment of database contents go to the URL: ' . $undoDeployURL);
pb_backupbuddy::status('undoDeployURL', $undoDeployURL);
// Pull importbuddy log instead of remote backup log. Nothing else is going to be done on remote server.
$this->_backup_options->options['deployment_log'] = $importbuddyLogURL;
$this->_backup_options->save();
// Next step.
pb_backupbuddy::status('details', 'Inserting deploy step to run importbuddy steps on remote server.');
$newStep = array('function' => 'deploy_runningImportBuddy', 'args' => array($state), 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0);
$this->insert_next_step($newStep);
return true;
}
示例2: _verb_renderImportBuddy
private static function _verb_renderImportBuddy()
{
$backupFile = pb_backupbuddy::_POST('backupFile');
$password = md5(md5(pb_backupbuddy::_POST('backupbuddy_api_key')));
// Store this serial in settings to cleanup any temp db tables in the future with this serial with periodic cleanup.
$backupSerial = backupbuddy_core::get_serial_from_file($backupFile);
pb_backupbuddy::$options['rollback_cleanups'][$backupSerial] = time();
pb_backupbuddy::save();
$importFileSerial = backupbuddy_core::deploymentImportBuddy($password, backupbuddy_core::getBackupDirectory() . $backupFile);
if (is_array($importFileSerial)) {
die(json_encode(array('success' => false, 'error' => $importFileSerial[1])));
} else {
die(json_encode(array('success' => true, 'importFileSerial' => $importFileSerial)));
}
}
示例3: _verb_renderImportBuddy
private static function _verb_renderImportBuddy()
{
$backupFile = pb_backupbuddy::_POST('backupFile');
$password = md5(md5(pb_backupbuddy::_POST('backupbuddy_api_key')));
$importFileSerial = backupbuddy_core::deploymentImportBuddy($password, backupbuddy_core::getBackupDirectory() . $backupFile);
if (is_array($importFileSerial)) {
die(json_encode(array('success' => false, 'error' => $importFileSerial[1])));
} else {
die(json_encode(array('success' => true, 'importFileSerial' => $importFileSerial)));
}
}