本文整理汇总了PHP中backupbuddy_core::render_dat_contents方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::render_dat_contents方法的具体用法?PHP backupbuddy_core::render_dat_contents怎么用?PHP backupbuddy_core::render_dat_contents使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::render_dat_contents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _step_send_pending_db_snapshots
private static function _step_send_pending_db_snapshots($startAt = 0)
{
// Load state into self::$_state & fileoptions object into self::$_stateObj.
if (false === self::_load_state()) {
return false;
}
if (false === self::_load_tables()) {
return false;
}
if (0 != $startAt) {
pb_backupbuddy::status('details', 'Resuming snapshot send at point `' . $startAt . '`.');
}
require_once pb_backupbuddy::plugin_path() . '/destinations/bootstrap.php';
backupbuddy_live::update_db_live_activity_time();
// On first pass create and send backupbuddy_dat.php and importbuddy.php.
if (0 == $startAt) {
// Render backupbuddy_dat.php
$dat_file = backupbuddy_live::getLiveDatabaseSnapshotDir() . 'backupbuddy_dat.php';
// Make sure directory exists.
if (!file_exists(dirname($dat_file))) {
if (false === pb_backupbuddy_filesystem::mkdir(dirname($dat_file))) {
pb_backupbuddy::status('warning', 'Warning #34893498434: Unable to mkdir("' . $dat_file . '").');
}
}
$tableSizes = array();
foreach (self::$_tables as $tableName => $table) {
$tableSizes[$tableName] = $table['s'];
}
$table_results = backupbuddy_live::_calculate_table_includes_excludes_basedump();
$dat_settings = array('backup_type' => 'live', 'profile' => array(), 'serial' => '', 'breakout_tables' => backupbuddy_live::calculateTables(), 'table_sizes' => $tableSizes, 'force_single_db_file' => false, 'trigger' => 'live', 'db_excludes' => $table_results[1], 'db_includes' => $table_results[0]);
pb_backupbuddy::status('details', 'Rendering DAT file to `' . $dat_file . '`.');
if (!is_array(backupbuddy_core::render_dat_contents($dat_settings, $dat_file))) {
$error = 'Error #47949743: Since DAT file could not be written aborting. Check permissions writing to `' . $dat_file . '`.';
pb_backupbuddy::status('error', $error);
return $error;
}
// Render importbuddy.php
$importbuddy_file = backupbuddy_live::getLiveDatabaseSnapshotDir() . 'importbuddy.php';
pb_backupbuddy::status('details', 'Rendering importbuddy file to `' . $importbuddy_file . '`.');
if (false === backupbuddy_core::importbuddy($importbuddy_file, $pass = NULL)) {
// NULL pass leaves #PASSWORD# placeholder in place.
pb_backupbuddy::status('warning', 'Warning #348438345: Unable to render importbuddy. Not backing up importbuddy.php.');
}
// Load destination settings.
$destination_settings = self::get_destination_settings();
// Send DAT file.
$send_id = 'live_' . md5($dat_file) . '-' . pb_backupbuddy::random_string(6);
$destination_settings['_database_table'] = 'backupbuddy_dat.php';
if (false === pb_backupbuddy_destinations::send($destination_settings, $dat_file, $send_id, $delete_after = true, $isRetry = false, $trigger = 'live_periodic', $destination_id = backupbuddy_live::getLiveID())) {
$error = 'Error #389398: Unable to send DAT file to Live servers. See error log above for details.';
pb_backupbuddy::status('error', $error);
backupbuddy_core::addNotification('live_error', 'BackupBuddy Stash Live Error', $error);
}
// Send importbuddy.
$send_id = 'live_' . md5($importbuddy_file) . '-' . pb_backupbuddy::random_string(6);
$destination_settings['_database_table'] = 'importbuddy.php';
if (false === pb_backupbuddy_destinations::send($destination_settings, $importbuddy_file, $send_id, $delete_after = true, $isRetry = false, $trigger = 'live_periodic', $destination_id = backupbuddy_live::getLiveID())) {
pb_backupbuddy::status('error', 'Error #329327: Unable to send importbuddy file to Live servers. See error log above for details.');
}
}
// Loop through files in the catalog.
$loopCount = 0;
$checkCount = 0;
$sendTimeSum = 0;
$sendSizeSum = 0;
$sendsStarted = 0;
$sendsSucceeded = 0;
$sendsMultiparted = 0;
$sendsFailed = 0;
$alreadyBackedUp = 0;
$tooManySendFails = 0;
$lastSendThisPass = false;
$sendMoreRemain = false;
foreach (self::$_tables as $table => &$tableDetails) {
$loopCount++;
if (0 != $startAt) {
// Resuming...
if ($loopCount < $startAt) {
continue;
}
}
$checkCount++;
// If backed up after modified time then it's up to date. Skip.
if ($tableDetails['b'] > $tableDetails['m']) {
pb_backupbuddy::status('details', 'Skipping send of table `' . $table . '` because it has already been sent since SQL file was made.');
$alreadyBackedUp++;
continue;
}
// Calculate table file.
$tableFile = backupbuddy_live::getLiveDatabaseSnapshotDir() . $table . '.sql';
// If too many attempts have passed then skip.
if ($tableDetails['t'] >= self::MAX_SEND_ATTEMPTS) {
pb_backupbuddy::status('error', 'Error #389328: This database file has failed transfer too many times. Skipping until next restart of periodic proces. File: `' . $tableFile . '`. Size: `' . pb_backupbuddy::$format->file_size(filesize($tableFile)) . '`.');
$tooManySendFails++;
continue;
}
// Load destination settings.
$destination_settings = self::get_destination_settings();
// If too many remote sends have failed today then give up for now since something is likely wrong.
if (self::$_state['stats']['recent_send_fails'] > $destination_settings['max_daily_failures']) {
//.........这里部分代码省略.........