本文整理汇总了PHP中pb_backupbuddy::get_status方法的典型用法代码示例。如果您正苦于以下问题:PHP pb_backupbuddy::get_status方法的具体用法?PHP pb_backupbuddy::get_status怎么用?PHP pb_backupbuddy::get_status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pb_backupbuddy
的用法示例。
在下文中一共展示了pb_backupbuddy::get_status方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: backup_status
public function backup_status()
{
// Make sure the serial exists.
if (pb_backupbuddy::_POST('serial') == '' || empty(pb_backupbuddy::$options['backups'][$_POST['serial']])) {
echo '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|0|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|error|~|Error #5445589. Invalid backup serial (' . htmlentities(pb_backupbuddy::_POST('serial')) . '). Please check directory permissions and your PHP error_log as an early backup function (such as pre_backup) may have failed. Fatal error.' . "\n";
echo '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|0|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|halt_script' . "\n";
} else {
// Return the status information since last retrieval.
$return_status = '!' . pb_backupbuddy::$format->localize_time(time()) . "|~|0|~|0|~|ping\n";
//error_log( print_r( pb_backupbuddy::$options['backups'], true ) );
foreach (pb_backupbuddy::$options['backups'][$_POST['serial']]['steps'] as $step) {
if ($step['start_time'] != 0 && $step['finish_time'] == 0) {
// A step has begun but has not finished. This should not happen but the WP cron is funky. Wait a while before continuing.
pb_backupbuddy::status('details', 'Waiting for function `' . $step['function'] . '` to complete. Started ' . (time() - $step['start_time']) . ' seconds ago.', $_POST['serial']);
if (time() - $step['start_time'] > 300) {
pb_backupbuddy::status('warning', 'The function `' . $step['function'] . '` is taking an abnormally long time to complete (' . (time() - $step['start_time']) . ' seconds). The backup may have stalled.', $_POST['serial']);
}
} elseif ($step['start_time'] == 0) {
// Step that has not started yet.
} else {
// Last case: Finished. Skip.
// Do nothing.
}
}
/********** Begin file sizes for status updates. *********/
$temporary_zip_directory = pb_backupbuddy::$options['backup_directory'] . 'temp_zip_' . $_POST['serial'] . '/';
if (file_exists($temporary_zip_directory)) {
// Temp zip file.
$directory = opendir($temporary_zip_directory);
while ($file = readdir($directory)) {
if ($file != '.' && $file != '..') {
$stats = stat($temporary_zip_directory . $file);
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|details|~|' . __('Temporary ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
}
}
closedir($directory);
unset($directory);
}
if (file_exists(pb_backupbuddy::$options['backups'][$_POST['serial']]['archive_file'])) {
// Final zip file.
$stats = stat(pb_backupbuddy::$options['backups'][$_POST['serial']]['archive_file']);
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|details|~|' . __('Final ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
}
/********** End file sizes for status updates. *********/
$status_lines = pb_backupbuddy::get_status(pb_backupbuddy::_POST('serial'), true, false, true);
// Clear file, dont unlink file (pclzip cant handle files unlinking mid-zip), dont show getting status message.
if ($status_lines !== false) {
// Only add lines if there is status contents.
foreach ($status_lines as $status_line) {
//$return_status .= '!' . $status_line[0] . '|' . $status_line[3] . '|' . $status_line[4] . '( ' . $status_line[1] . 'secs / ' . $status_line[2] . 'MB )' . "\n";
$return_status .= '!' . implode('|~|', $status_line) . "\n";
}
}
// Return messages.
echo $return_status;
}
die;
}
示例2: backup_integrity_check
function backup_integrity_check($file)
{
$serial = $this->get_serial_from_file($file);
// User selected to rescan a file.
if (pb_backupbuddy::_GET('reset_integrity') == $serial) {
pb_backupbuddy::alert('Rescanning backup integrity for backup file `' . basename($file) . '`');
}
if (isset(pb_backupbuddy::$options['backups'][$serial]['integrity']) && count(pb_backupbuddy::$options['backups'][$serial]['integrity']) > 0 && pb_backupbuddy::_GET('reset_integrity') != $serial) {
// Already have integrity data and NOT resetting this one.
pb_backupbuddy::status('details', 'Integrity data for backup `' . $serial . '` is cached; not scanning again.');
return;
} elseif (pb_backupbuddy::_GET('reset_integrity') == $serial) {
// Resetting this one.
pb_backupbuddy::status('details', 'Resetting backup integrity stats for backup with serial `' . $serial . '`.');
}
if (pb_backupbuddy::$options['integrity_check'] == '0') {
// Integrity checking disabled.
$file_stats = @stat($file);
if ($file_stats === false) {
// stat failure.
pb_backupbuddy::alert('Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt or too large for the server.');
$file_size = 0;
$file_modified = 0;
} else {
// stat success.
$file_size = $file_stats['size'];
$file_modified = $file_stats['mtime'];
}
unset($file_stats);
$integrity = array('status' => 'Unknown', 'status_details' => __('Integrity checking disabled based on settings. This file has not been verified.', 'it-l10n-backupbuddy'), 'scan_time' => 0, 'detected_type' => 'unknown', 'size' => $file_size, 'modified' => $file_modified, 'file' => basename($file), 'comment' => false);
pb_backupbuddy::$options['backups'][$serial]['integrity'] = array_merge(pb_backupbuddy::settings('backups_integrity_defaults'), $integrity);
pb_backupbuddy::save();
return;
}
// Defaults
$integrity_checked = true;
$found_dat = false;
$found_sql = false;
$found_wpc = false;
$backup_type = '';
if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(pb_backupbuddy::$options['backup_directory']);
}
// Redirect logging output to a certain log file.
pb_backupbuddy::set_status_serial('zipbuddy_test');
// Look for comment.
$comment = pb_backupbuddy::$classes['zipbuddy']->get_comment($file);
// Check for DAT file.
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php') === true) {
// Post 2.0 full backup
$found_dat = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php') === true) {
// Pre 2.0 full backup
$found_dat = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'backupbuddy_dat.php') === true) {
// DB backup
$found_dat = true;
$backup_type = 'db';
}
// Check for DB SQL file.
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/db_1.sql') === true) {
// post 2.0 full backup
$found_sql = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/db.sql') === true) {
// pre 2.0 full backup
$found_sql = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'db_1.sql') === true) {
// db only backup 2.0+
$found_sql = true;
$backup_type = 'db';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'db.sql') === true) {
// db only backup pre-2.0
$found_sql = true;
$backup_type = 'db';
}
// Check for WordPress config file.
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-config.php') === true) {
$found_wpc = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/wp-config.php') === true) {
$found_wpc = true;
$backup_type = 'full';
}
// Calculate status from results.
$integrity_status = 'pass';
$integrity_description = '';
$status_items = pb_backupbuddy::get_status('zipbuddy_test');
$integrity_zipresult_details = array();
foreach ((array) $status_items as $status_item) {
//.........这里部分代码省略.........
示例3: backup_status
public function backup_status()
{
$serial = trim(pb_backupbuddy::_POST('serial'));
// Make sure the serial exists.
if ($serial == '' || empty(pb_backupbuddy::$options['backups'][$serial])) {
echo '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|0|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|error|~|Error #9031. Invalid backup serial (' . htmlentities($serial) . '). Please check directory permissions for your wp-content/uploads/ directory recursively, your PHP error_log for any errors, and that you have enough free disk space. If seeking support please provide this full status log and PHP error log. Fatal error.' . "\n";
echo '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|0|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|halt_script' . "\n";
} else {
// Verify init completed.
if (false === pb_backupbuddy::$options['backups'][$serial]['init_complete']) {
pb_backupbuddy::status('error', 'Error #9033: The pre-backup initialization did not fully complete. Check for any errors above or in logs. Verify permissions & that there is enough server memory. See the BackupBuddy "Server Information" page to help assess your server.', $serial);
pb_backupbuddy::status('action', 'halt_script', $serial);
}
//***** Begin outputting status of the current step.
foreach (pb_backupbuddy::$options['backups'][$serial]['steps'] as $step) {
if ($step['start_time'] != 0 && $step['finish_time'] == 0) {
// A step has begun but has not finished. This should not happen but the WP cron is funky. Wait a while before continuing.
// For database dump step output the SQL file current size.
if ($step['function'] == 'backup_create_database_dump') {
$sql_file = pb_backupbuddy::$options['backups'][$serial]['temp_directory'] . 'db_1.sql';
if (file_exists($sql_file)) {
$sql_filesize = pb_backupbuddy::$format->file_size(filesize($sql_file));
} else {
// No SQL file yet.
$sql_filesize = '[SQL file not found yet]';
}
pb_backupbuddy::status('details', 'Current SQL database dump file size: ' . $sql_filesize . '.', $serial);
}
pb_backupbuddy::status('details', 'Waiting for function `' . $step['function'] . '` to complete. Started ' . (time() - $step['start_time']) . ' seconds ago.', $serial);
if (time() - $step['start_time'] > 300) {
pb_backupbuddy::status('warning', 'The function `' . $step['function'] . '` is taking an abnormally long time to complete (' . (time() - $step['start_time']) . ' seconds). The backup may have stalled.', $serial);
}
} elseif ($step['start_time'] == 0) {
// Step that has not started yet.
} else {
// Last case: Finished. Skip.
// Do nothing.
}
}
//***** End outputting status of the current step.
//***** Begin output of temp zip file size.
$temporary_zip_directory = pb_backupbuddy::$options['backup_directory'] . 'temp_zip_' . $serial . '/';
if (file_exists($temporary_zip_directory)) {
// Temp zip file.
$directory = opendir($temporary_zip_directory);
while ($file = readdir($directory)) {
if ($file != '.' && $file != '..' && $file != 'exclusions.txt') {
$stats = stat($temporary_zip_directory . $file);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|details|~|' . __('Temporary ZIP file size', 'it-l10n-backupbuddy' ) .': ' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";;
pb_backupbuddy::status('details', __('Temporary ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";
pb_backupbuddy::status('action', 'archive_size^' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
}
}
closedir($directory);
unset($directory);
}
//***** End output of temp zip file size.
// Output different stuff to the browser depending on whether backup is finished or not.
if (pb_backupbuddy::$options['backups'][$serial]['finish_time'] > 0) {
// BACKUP FINISHED.
// OUTPUT COMPLETED ZIP FINAL SIZE.
if (file_exists(pb_backupbuddy::$options['backups'][$serial]['archive_file'])) {
// Final zip file.
$stats = stat(pb_backupbuddy::$options['backups'][$serial]['archive_file']);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|details|~|' . __('Completed backup final ZIP file size', 'it-l10n-backupbuddy' ) . ': ' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";;
pb_backupbuddy::status('details', __('Completed backup final ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";
pb_backupbuddy::status('action', 'archive_size^' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
$backup_finished = true;
} else {
pb_backupbuddy::status('error', __('Backup reports success but unable to access final ZIP file. Verify permissions and ownership. If the error persists insure that server is properly configured with suphp and proper ownership & permissions.', 'it-l10n-backupbuddy'), $serial);
}
pb_backupbuddy::status('message', __('Backup successfully completed in ', 'it-l10n-backupbuddy') . ' ' . pb_backupbuddy::$format->time_duration(pb_backupbuddy::$options['backups'][$serial]['finish_time'] - pb_backupbuddy::$options['backups'][$serial]['start_time']) . '.', $serial);
pb_backupbuddy::status('action', 'finish_backup', $serial);
} else {
// NOT FINISHED
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . "|~|0|~|0|~|ping\n";
pb_backupbuddy::status('message', __('Ping. Waiting for server . . .', 'it-l10n-backupbuddy'), $serial);
}
//***** Begin getting status log information.
$return_status = '';
$status_lines = pb_backupbuddy::get_status($serial, true, false, true);
// Clear file, dont unlink file (pclzip cant handle files unlinking mid-zip), dont show getting status message.
if ($status_lines !== false) {
// Only add lines if there is status contents.
foreach ($status_lines as $status_line) {
//$return_status .= '!' . $status_line[0] . '|' . $status_line[3] . '|' . $status_line[4] . '( ' . $status_line[1] . 'secs / ' . $status_line[2] . 'MB )' . "\n";
$return_status .= '!' . implode('|~|', $status_line) . "\n";
}
}
//***** End getting status log information.
echo $return_status;
// Return messages.
}
die;
}
示例4: backup_status
//.........这里部分代码省略.........
foreach ($backup['steps'] as $step) {
if ($step['start_time'] != -1 && $step['start_time'] != 0 && $step['finish_time'] == 0) {
// A step isnt mark to skip, has begun but has not finished. This should not happen but the WP cron is funky. Wait a while before continuing.
// For database dump step output the SQL file current size.
if ($step['function'] == 'backup_create_database_dump') {
$sql_file = $backup['temp_directory'] . 'db_1.sql';
if (file_exists($sql_file)) {
$sql_filesize = pb_backupbuddy::$format->file_size(filesize($sql_file));
} else {
// No SQL file yet.
$sql_filesize = '[SQL file not found yet]';
}
pb_backupbuddy::status('details', 'Current SQL database dump file size: ' . $sql_filesize . '.', $serial);
}
pb_backupbuddy::status('details', 'Waiting for function `' . $step['function'] . '` to complete. Started ' . (time() - $step['start_time']) . ' seconds ago.', $serial);
if (time() - $step['start_time'] > 300) {
pb_backupbuddy::status('warning', 'The function `' . $step['function'] . '` is taking an abnormally long time to complete (' . (time() - $step['start_time']) . ' seconds). The backup may have failed. If it does not increase in the next few minutes it most likely timed out. See the Status Log for details.', $serial);
}
} elseif ($step['start_time'] == 0) {
// Step that has not started yet.
// Do nothing.
} elseif ($step['start_time'] == -1) {
// Step marked for skipping (backup stop button hit).
// Do nothing.
} else {
// Last case: Finished. Skip.
// Do nothing.
}
}
//***** End outputting status of the current step.
//***** Begin output of temp zip file size.
$temporary_zip_directory = backupbuddy_core::getBackupDirectory() . 'temp_zip_' . $serial . '/';
if (file_exists($temporary_zip_directory)) {
// Temp zip file.
$directory = opendir($temporary_zip_directory);
while ($file = readdir($directory)) {
if ($file != '.' && $file != '..' && $file != 'exclusions.txt' && !preg_match('/.*\\.txt/', $file) && !preg_match('/pclzip.*\\.gz/', $file)) {
$stats = stat($temporary_zip_directory . $file);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|details|~|' . __('Temporary ZIP file size', 'it-l10n-backupbuddy' ) .': ' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";;
pb_backupbuddy::status('details', __('Temporary ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";
pb_backupbuddy::status('action', 'archive_size^' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
}
}
closedir($directory);
unset($directory);
}
//***** End output of temp zip file size.
// Output different stuff to the browser depending on whether backup is finished or not.
if ($backup['finish_time'] > 0) {
// BACKUP FINISHED.
// OUTPUT COMPLETED ZIP FINAL SIZE.
if (file_exists($backup['archive_file'])) {
// Final zip file.
$stats = stat($backup['archive_file']);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|details|~|' . __('Completed backup final ZIP file size', 'it-l10n-backupbuddy' ) . ': ' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";;
pb_backupbuddy::status('details', '--- ' . __('New PHP process.'), $serial);
pb_backupbuddy::status('details', __('Completed backup final ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . '|~|' . round ( microtime( true ) - pb_backupbuddy::$start_time, 2 ) . '|~|' . round( memory_get_peak_usage() / 1048576, 2 ) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size( $stats['size'] ) . "\n";
pb_backupbuddy::status('action', 'archive_size^' . pb_backupbuddy::$format->file_size($stats['size']), $serial);
$backup_finished = true;
} else {
$purposeful_deletion = false;
foreach ($backup['steps'] as $step) {
if ($step['function'] == 'send_remote_destination') {
if ($step['args'][1] == true) {
pb_backupbuddy::status('details', 'Option to delete local backup after successful send enabled so local file deleted.');
$purposeful_deletion = true;
break;
}
}
}
if ($purposeful_deletion !== true) {
pb_backupbuddy::status('error', __('Backup reports success but unable to access final ZIP file. Verify permissions and ownership. If the error persists insure that server is properly configured with suphp and proper ownership & permissions.', 'it-l10n-backupbuddy'), $serial);
}
}
pb_backupbuddy::status('message', __('Backup successfully completed in ', 'it-l10n-backupbuddy') . ' ' . pb_backupbuddy::$format->time_duration($backup['finish_time'] - $backup['start_time']) . '.', $serial);
pb_backupbuddy::status('action', 'finish_backup', $serial);
} else {
// NOT FINISHED
//$return_status .= '!' . pb_backupbuddy::$format->localize_time( time() ) . "|~|0|~|0|~|ping\n";
pb_backupbuddy::status('message', __('Ping. Waiting for server . . .', 'it-l10n-backupbuddy'), $serial);
}
//***** Begin getting status log information.
$return_status = '';
$status_lines = pb_backupbuddy::get_status($serial, true, false, true);
// Clear file, dont unlink file (pclzip cant handle files unlinking mid-zip), dont show getting status message.
if ($status_lines !== false) {
// Only add lines if there is status contents.
foreach ($status_lines as $status_line) {
//$return_status .= '!' . $status_line[0] . '|' . $status_line[3] . '|' . $status_line[4] . '( ' . $status_line[1] . 'secs / ' . $status_line[2] . 'MB )' . "\n";
$return_status .= '!' . implode('|~|', $status_line) . "\n";
}
}
//***** End getting status log information.
echo $return_status;
// Return messages.
}
die;
}
示例5: str_replace
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/wp-config.php') === true) {
$pass = true;
}
if (false === $pass) {
if (isset($options['excludes'])) {
if (false !== stristr($options['excludes'], 'wp-config.')) {
pb_backupbuddy::status('warning', 'Warning: An exclusion containing wp-config.php was found. Exclusions: `' . str_replace(array("\r", "\r\n", "\n"), '; ', $options['excludes']) . '`.');
}
}
}
$tests[] = array('test' => 'WordPress wp-config.php file (full backups only)', 'pass' => $pass);
}
// end if full backup.
// Get zip scan log details.
pb_backupbuddy::status('details', 'Retrieving zip scan log.');
$temp_details = pb_backupbuddy::get_status('zipbuddy_test');
// Get zipbuddy scan log.
$scan_log = array();
foreach ($temp_details as $temp_detail) {
$scan_log[] = json_decode($temp_detail)->{'data'};
}
if (true !== $skipLogRedirect) {
pb_backupbuddy::set_status_serial($previous_status_serial);
// Stop redirecting log to a specific file & set back to what it was prior.
pb_backupbuddy::status('details', 'Stopped temporary redirection of status logging.');
}
pb_backupbuddy::status('details', 'Calculating integrity scan status,');
// Check for any failed tests.
$is_ok = true;
$integrity_description = '';
foreach ($tests as $test) {
示例6: backup_integrity_check
function backup_integrity_check($file, $fileoptions = '', $options = array())
{
$options = array_merge(array('skip_database_dump' => '0'), $options);
pb_backupbuddy::status('details', 'Started backup_integrity_check() function.');
$serial = $this->get_serial_from_file($file);
// User selected to rescan a file.
if (pb_backupbuddy::_GET('reset_integrity') == $serial) {
pb_backupbuddy::alert('Rescanning backup integrity for backup file `' . basename($file) . '`');
}
if ($fileoptions != '') {
$backup_options =& $fileoptions;
} else {
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
$backup_options = new pb_backupbuddy_fileoptions(pb_backupbuddy::$options['log_directory'] . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true);
// Will create file to hold integrity data if nothing exists.
if (true !== ($result = $backup_options->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034 C. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error on file `' . pb_backupbuddy::$options['log_directory'] . 'fileoptions/' . $serial . '.txt' . '`: ' . $result);
pb_backupbuddy::status('action', 'halt_script');
// Halt JS on page.
return false;
}
if (isset($backup_options->options['profile'])) {
$options = $backup_options->options['profile'];
$options = array_merge(pb_backupbuddy::settings('profile_defaults'), $options);
}
}
if (isset($backup_options->options['integrity']) && count($backup_options->options['integrity']) > 0 && pb_backupbuddy::_GET('reset_integrity') != $serial) {
// Already have integrity data and NOT resetting this one.
pb_backupbuddy::status('details', 'Integrity data for backup `' . $serial . '` is cached; not scanning again.');
return true;
} elseif (pb_backupbuddy::_GET('reset_integrity') == $serial) {
// Resetting this one.
pb_backupbuddy::status('details', 'Resetting backup integrity stats for backup with serial `' . $serial . '`.');
} else {
// No integrity data; not resetting. Just keep going...
}
if (pb_backupbuddy::$options['profiles'][0]['integrity_check'] == '0' && pb_backupbuddy::_GET('reset_integrity') == '') {
// Integrity checking disabled. Allows run if manually rescanning on backups page.
pb_backupbuddy::status('details', 'Integrity check disabled. Skipping scan.');
$file_stats = @stat($file);
if ($file_stats === false) {
// stat failure.
pb_backupbuddy::status('error', 'Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt or too large for the server.');
$file_size = 0;
$file_modified = 0;
} else {
// stat success.
$file_size = $file_stats['size'];
$file_modified = $file_stats['mtime'];
}
unset($file_stats);
$integrity = array('status' => 'Unknown', 'tests' => array(), 'scan_time' => 0, 'detected_type' => 'unknown', 'size' => $file_size, 'modified' => $file_modified, 'file' => basename($file), 'comment' => false);
$backup_options->options['integrity'] = array_merge(pb_backupbuddy::settings('backups_integrity_defaults'), $integrity);
$backup_options->save();
return true;
}
//***** BEGIN CALCULATING STATUS DETAILS.
$backup_type = '';
if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(pb_backupbuddy::$options['backup_directory']);
}
pb_backupbuddy::status('details', 'Redirecting status logging temporarily.');
$previous_status_serial = pb_backupbuddy::get_status_serial();
// Store current status serial setting to reset back later.
pb_backupbuddy::set_status_serial('zipbuddy_test');
// Redirect logging output to a certain log file.
// Look for comment.
pb_backupbuddy::status('details', 'Verifying comment in zip archive.');
$raw_comment = pb_backupbuddy::$classes['zipbuddy']->get_comment($file);
$comment = pb_backupbuddy::$classes['core']->normalize_comment_data($raw_comment);
$comment = $comment['note'];
$tests = array();
// Check for DAT file.
$pass = false;
pb_backupbuddy::status('details', 'Verifying DAT file in zip archive.');
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php') === true) {
// Post 2.0 full backup
$backup_type = 'full';
$pass = true;
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php') === true) {
// Pre 2.0 full backup
$backup_type = 'full';
$pass = true;
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'backupbuddy_dat.php') === true) {
// DB backup
$backup_type = 'db';
$pass = true;
}
$tests[] = array('test' => 'BackupBackup data file exists', 'pass' => $pass);
// Skip database checks if needed.
//if ( $options['skip_database_dump'] != '1' ) {
// Check for DB SQL file.
$pass = false;
pb_backupbuddy::status('details', 'Verifying database SQL file in zip archive.');
if ($options['skip_database_dump'] == '1') {
pb_backupbuddy::status('warning', 'WARNING: Database .SQL file does NOT exist because the database dump has been set to be SKIPPED based on settings. Use with cuation!');
} else {
//.........这里部分代码省略.........
示例7: section
//***** Begin getting status log information.
if ('' != $backup['deployment_log']) {
//error_log( print_r( $backup, true ) );
if ('push' == $backup['deployment_direction']) {
pb_backupbuddy::status('details', 'About to retrieve push deployment status log from `' . $backup['deployment_log'] . '`...', $serial);
pb_backupbuddy::status('details', '** Begin External Log section (ImportBuddy)', $serial);
} elseif ('pull' == $backup['deployment_direction']) {
pb_backupbuddy::status('details', 'About to retrieve pull deployment status log from `' . $backup['deployment_log'] . '`...', $serial);
pb_backupbuddy::status('details', '*** Begin External Log Section (Remote backup or ImportBuddy)', $serial);
} else {
pb_backupbuddy::status('error', 'Error #84377834: Deployment log set but direction missing.', $serial);
}
}
// Get local status log and output it.
//echo "\nEND_DEPLOY\n"; // In case prior end deploy signal did not go out.
$status_lines = pb_backupbuddy::get_status($serial, true, false, true);
// Clear file, dont unlink file, supress status retrieval msg.
echo implode('', $status_lines);
// DEPLOYMENT OUTPUT.
if ('' != $backup['deployment_log']) {
echo "\nSTART_DEPLOY\n";
if ('push' == $backup['deployment_direction']) {
// *** PUSH
$response = wp_remote_get($backup['deployment_log'], array('method' => 'GET', 'timeout' => 10, 'redirection' => 5, 'httpversion' => '1.0', 'blocking' => true, 'headers' => array(), 'body' => null, 'cookies' => array()));
if (is_wp_error($response)) {
// Loopback failed. Some kind of error.
$error = $response->get_error_message();
pb_backupbuddy::status('error', 'Error retrieving remote deployment log. Details: `' . $error . '`.', $serial);
} else {
if ('200' == $response['response']['code']) {
//error_log( print_r( $response, true ) );
示例8: status
/**
* status()
*
* Write a status line into an existing textarea created with the status_box() function.
*
* @param $type string message, details, error, or warning. Currently not in use.
* @param $message string Message to append to the status box.
* @return null
*/
function status($type, $message)
{
pb_backupbuddy::status($type, $message);
$status_lines = pb_backupbuddy::get_status('ms_import', true, true, true);
// $serial = '', $clear_retrieved = true, $erase_retrieved = true, $hide_getting_status = false
if ($status_lines !== false) {
// Only add lines if there is status contents.
foreach ($status_lines as $status_line) {
$status_line[0] = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($status_line[0]));
$status_line[1] .= 'sec';
$status_line[2] .= 'MB';
echo '<script type="text/javascript">jQuery( "#importbuddy_status" ).append( "\\n' . implode("\t", $status_line) . '"); textareaelem = document.getElementById( "importbuddy_status" ); textareaelem.scrollTop = textareaelem.scrollHeight; </script>';
pb_backupbuddy::flush();
}
}
/*
$message = htmlentities( addslashes( $message ) );
$status = date( $this->_parent->_parent->_timestamp, time() ) . ': ' . $message;
echo '<script type="text/javascript">jQuery( "#importbuddy_status" ).append( "\n' . $status . '"); textareaelem = document.getElementById( "importbuddy_status" ); textareaelem.scrollTop = textareaelem.scrollHeight; </script>';
pb_backupbuddy::flush();
if ( $type == 'error' ) {
$this->log( $message, 'error' );
} elseif ( $type == 'warning' ) {
$this->log( $message, 'warning' );
} else {
$this->log( '[' . $type . ']' . $message, 'all' );
}
*/
}
示例9: status
/**
* status()
*
* Write a status line into an existing textarea created with the status_box() function.
*
* @param $type string message, details, error, or warning. Currently not in use.
* @param $message string Message to append to the status box.
* @return null
*/
function status($type, $message)
{
pb_backupbuddy::status($type, $message);
$status_lines = pb_backupbuddy::get_status('ms_import', true, true, true);
// $serial = '', $clear_retrieved = true, $erase_retrieved = true, $hide_getting_status = false
if ($status_lines !== false) {
// Only add lines if there is status contents.
foreach ($status_lines as $status_line) {
$status_line[0] = pb_backupbuddy::$format->date(pb_backupbuddy::$format->localize_time($status_line[0]));
$status_line[1] .= 'sec';
$status_line[2] .= 'MB';
echo '<script type="text/javascript">jQuery( "#importbuddy_status" ).append( "\\n' . implode("\t", $status_line) . '"); textareaelem = document.getElementById( "importbuddy_status" ); textareaelem.scrollTop = textareaelem.scrollHeight; </script>';
pb_backupbuddy::flush();
}
}
}
示例10: backup_status
public function backup_status()
{
// Make sure the serial exists.
if (pb_backupbuddy::_POST('serial') == '' || empty(pb_backupbuddy::$options['backups'][pb_backupbuddy::_POST('serial')])) {
echo '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|0|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|error|~|Error #9031. Invalid backup serial (' . htmlentities(pb_backupbuddy::_POST('serial')) . '). Please check directory permissions for your wp-content/uploads/ directory recursively, your PHP error_log for any errors, and that you have enough free disk space. Fatal error.' . "\n";
echo '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|0|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|halt_script' . "\n";
} else {
$return_status = '';
//error_log( print_r( pb_backupbuddy::$options['backups'], true ) );
foreach (pb_backupbuddy::$options['backups'][pb_backupbuddy::_POST('serial')]['steps'] as $step) {
if ($step['start_time'] != 0 && $step['finish_time'] == 0) {
// A step has begun but has not finished. This should not happen but the WP cron is funky. Wait a while before continuing.
// For database dump step output the SQL file current size.
if ($step['function'] == 'backup_create_database_dump') {
$sql_file = pb_backupbuddy::$options['backups'][pb_backupbuddy::_POST('serial')]['temp_directory'] . 'db_1.sql';
if (file_exists($sql_file)) {
$sql_filesize = pb_backupbuddy::$format->file_size(filesize($sql_file));
} else {
// No SQL file yet.
$sql_filesize = '[SQL file not found yet]';
}
pb_backupbuddy::status('details', 'Current SQL database dump file size: ' . $sql_filesize . '.', pb_backupbuddy::_POST('serial'));
}
pb_backupbuddy::status('details', 'Waiting for function `' . $step['function'] . '` to complete. Started ' . (time() - $step['start_time']) . ' seconds ago.', pb_backupbuddy::_POST('serial'));
if (time() - $step['start_time'] > 300) {
pb_backupbuddy::status('warning', 'The function `' . $step['function'] . '` is taking an abnormally long time to complete (' . (time() - $step['start_time']) . ' seconds). The backup may have stalled.', pb_backupbuddy::_POST('serial'));
}
} elseif ($step['start_time'] == 0) {
// Step that has not started yet.
} else {
// Last case: Finished. Skip.
// Do nothing.
}
}
$status_lines = pb_backupbuddy::get_status(pb_backupbuddy::_POST('serial'), true, false, true);
// Clear file, dont unlink file (pclzip cant handle files unlinking mid-zip), dont show getting status message.
if ($status_lines !== false) {
// Only add lines if there is status contents.
foreach ($status_lines as $status_line) {
//$return_status .= '!' . $status_line[0] . '|' . $status_line[3] . '|' . $status_line[4] . '( ' . $status_line[1] . 'secs / ' . $status_line[2] . 'MB )' . "\n";
$return_status .= '!' . implode('|~|', $status_line) . "\n";
}
}
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . "|~|0|~|0|~|ping\n";
/********** Begin file sizes for status updates. *********/
$temporary_zip_directory = pb_backupbuddy::$options['backup_directory'] . 'temp_zip_' . pb_backupbuddy::_POST('serial') . '/';
if (file_exists($temporary_zip_directory)) {
// Temp zip file.
$directory = opendir($temporary_zip_directory);
while ($file = readdir($directory)) {
if ($file != '.' && $file != '..' && $file != 'exclusions.txt') {
$stats = stat($temporary_zip_directory . $file);
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|details|~|' . __('Temporary ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
}
}
closedir($directory);
unset($directory);
}
if (file_exists(pb_backupbuddy::$options['backups'][pb_backupbuddy::_POST('serial')]['archive_file'])) {
// Final zip file.
$stats = stat(pb_backupbuddy::$options['backups'][pb_backupbuddy::_POST('serial')]['archive_file']);
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|details|~|' . __('Completed backup final ZIP file size', 'it-l10n-backupbuddy') . ': ' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
$return_status .= '!' . pb_backupbuddy::$format->localize_time(time()) . '|~|' . round(microtime(true) - pb_backupbuddy::$start_time, 2) . '|~|' . round(memory_get_peak_usage() / 1048576, 2) . '|~|action|~|archive_size^' . pb_backupbuddy::$format->file_size($stats['size']) . "\n";
}
/********** End file sizes for status updates. *********/
// Return messages.
echo $return_status;
}
die;
}
示例11: backup_integrity_check
public static function backup_integrity_check($file, $fileoptions = '', $options = array(), $skipLogRedirect = false)
{
pb_backupbuddy::status('details', 'Started backup_integrity_check() function.');
$serial = self::get_serial_from_file($file);
// User selected to rescan a file.
if (pb_backupbuddy::_GET('reset_integrity') == $serial) {
pb_backupbuddy::alert('Rescanning backup integrity for backup file `' . basename($file) . '`');
pb_backupbuddy::flush();
}
$options = array_merge(array('skip_database_dump' => '0'), $options);
$scan_notes = array();
// Get backup fileoptions.
if ($fileoptions != '') {
$backup_options =& $fileoptions;
} else {
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
$backup_options = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true);
// Will create file to hold integrity data if nothing exists.
if (true !== ($result = $backup_options->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034 C. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error on file `' . backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt' . '`: ' . $result);
pb_backupbuddy::status('haltScript', '');
// Halt JS on page.
return false;
}
}
if (isset($backup_options->options['profile'])) {
$options = $backup_options->options['profile'];
$options = array_merge(pb_backupbuddy::settings('profile_defaults'), $options);
}
// Return if cached.
if (isset($backup_options->options['integrity']) && count($backup_options->options['integrity']) > 0 && pb_backupbuddy::_GET('reset_integrity') != $serial) {
// Already have integrity data and NOT resetting this one.
pb_backupbuddy::status('details', 'Integrity data for backup `' . $serial . '` is cached; not scanning again.');
return $backup_options->options['integrity'];
} elseif (pb_backupbuddy::_GET('reset_integrity') == $serial) {
// Resetting this one.
pb_backupbuddy::status('details', 'Resetting backup integrity stats for backup with serial `' . $serial . '`.');
} else {
// No integrity data; not resetting. Just keep going...
}
// Integrity check disabled. Skip.
if (pb_backupbuddy::$options['profiles'][0]['integrity_check'] == '0' && pb_backupbuddy::_GET('reset_integrity') == '' && isset($options['integrity_check']) && $options['integrity_check'] == '0') {
// Integrity checking disabled. Allows run if manually rescanning on backups page.
pb_backupbuddy::status('details', 'Integrity check disabled. Skipping scan.');
$file_stats = @stat($file);
if ($file_stats === false) {
// stat failure.
pb_backupbuddy::status('error', 'Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt or too large for the server.');
$file_size = 0;
$file_modified = 0;
} else {
// stat success.
$file_size = $file_stats['size'];
$file_modified = $file_stats['mtime'];
}
unset($file_stats);
$integrity = array('status' => 'Unknown', 'tests' => array(), 'scan_time' => 0, 'detected_type' => 'unknown', 'size' => $file_size, 'modified' => $file_modified, 'file' => basename($file), 'comment' => false);
$backup_options->options['integrity'] = array_merge(pb_backupbuddy::settings('backups_integrity_defaults'), $integrity);
$backup_options->save();
return $backup_options->options['integrity'];
}
//***** BEGIN CALCULATING STATUS DETAILS.
$backup_type = '';
if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(backupbuddy_core::getBackupDirectory());
}
$previous_status_serial = pb_backupbuddy::get_status_serial();
// Store current status serial setting to reset back later.
if (true !== $skipLogRedirect) {
pb_backupbuddy::status('details', 'Redirecting status logging temporarily.');
pb_backupbuddy::set_status_serial('zipbuddy_test');
// Redirect logging output to a certain log file.
}
// Look for comment.
pb_backupbuddy::status('details', 'Verifying comment in zip archive.');
$raw_comment = pb_backupbuddy::$classes['zipbuddy']->get_comment($file);
$comment = backupbuddy_core::normalize_comment_data($raw_comment);
$comment = $comment['note'];
$tests = array();
pb_backupbuddy::status('details', 'NOTE: It is normal to see several "File not found" messages in the next several log lines.');
// Check for DAT file.
$pass = false;
pb_backupbuddy::status('details', 'Verifying DAT file in zip archive.');
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php') === true) {
// Post 2.0 full backup
$backup_type = 'full';
$pass = true;
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php') === true) {
// Pre 2.0 full backup
$backup_type = 'full';
$pass = true;
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'backupbuddy_dat.php') === true) {
// DB backup
$backup_type = 'db';
$pass = true;
}
$tests[] = array('test' => 'BackupBuddy data file', 'pass' => $pass);
//.........这里部分代码省略.........
示例12: die
<?php
if (!defined('PB_IMPORTBUDDY') || true !== PB_IMPORTBUDDY) {
die('<html></html>');
}
if ('true' != pb_backupbuddy::_GET('deploy')) {
die('Access denied.');
}
// Only allow access to this file if it has a serial hiding it. Used by deployment.
global $importbuddy_file;
$importFileSerial = backupbuddy_core::get_serial_from_file($importbuddy_file);
if ('' == $importFileSerial) {
die('Access denied.');
}
pb_backupbuddy::status('details', '*** End ImportBuddy Log section');
$status_lines = pb_backupbuddy::get_status('', true, false, true);
// Clear file, dont unlink file, supress status retrieval msg.
echo implode('', $status_lines);
示例13: backup_integrity_check
function backup_integrity_check($file)
{
pb_backupbuddy::status('details', 'Started backup_integrity_check() function.');
$serial = $this->get_serial_from_file($file);
// User selected to rescan a file.
if (pb_backupbuddy::_GET('reset_integrity') == $serial) {
pb_backupbuddy::alert('Rescanning backup integrity for backup file `' . basename($file) . '`');
}
if (isset(pb_backupbuddy::$options['backups'][$serial]['integrity']) && count(pb_backupbuddy::$options['backups'][$serial]['integrity']) > 0 && pb_backupbuddy::_GET('reset_integrity') != $serial) {
// Already have integrity data and NOT resetting this one.
pb_backupbuddy::status('details', 'Integrity data for backup `' . $serial . '` is cached; not scanning again.');
return true;
} elseif (pb_backupbuddy::_GET('reset_integrity') == $serial) {
// Resetting this one.
pb_backupbuddy::status('details', 'Resetting backup integrity stats for backup with serial `' . $serial . '`.');
} else {
// No integrity data; not resetting. Just keep going...
}
if (pb_backupbuddy::$options['integrity_check'] == '0') {
// Integrity checking disabled.
pb_backupbuddy::status('details', 'Integrity check disabled. Skipping scan.');
$file_stats = @stat($file);
if ($file_stats === false) {
// stat failure.
pb_backupbuddy::status('error', 'Error #4539774. Unable to get file details ( via stat() ) for file `' . $file . '`. The file may be corrupt or too large for the server.');
$file_size = 0;
$file_modified = 0;
} else {
// stat success.
$file_size = $file_stats['size'];
$file_modified = $file_stats['mtime'];
}
unset($file_stats);
$integrity = array('status' => 'Unknown', 'status_details' => __('Integrity checking disabled based on settings. This file has not been verified.', 'it-l10n-backupbuddy'), 'scan_time' => 0, 'detected_type' => 'unknown', 'size' => $file_size, 'modified' => $file_modified, 'file' => basename($file), 'comment' => false);
pb_backupbuddy::$options['backups'][$serial]['integrity'] = array_merge(pb_backupbuddy::settings('backups_integrity_defaults'), $integrity);
pb_backupbuddy::save();
return true;
}
//***** BEGIN CALCULATING STATUS DETAILS.
// Status defaults.
$status_details = array('found_dat' => false, 'found_sql' => false, 'found_wpconfig' => false, 'scan_log' => '');
$backup_type = '';
if (!isset(pb_backupbuddy::$classes['zipbuddy'])) {
require_once pb_backupbuddy::plugin_path() . '/lib/zipbuddy/zipbuddy.php';
pb_backupbuddy::$classes['zipbuddy'] = new pluginbuddy_zipbuddy(pb_backupbuddy::$options['backup_directory']);
}
pb_backupbuddy::status('details', 'Redirecting status logging temporarily.');
$previous_status_serial = pb_backupbuddy::get_status_serial();
// Store current status serial setting to reset back later.
pb_backupbuddy::set_status_serial('zipbuddy_test');
// Redirect logging output to a certain log file.
// Look for comment.
pb_backupbuddy::status('details', 'Verifying comment in zip archive.');
$raw_comment = pb_backupbuddy::$classes['zipbuddy']->get_comment($file);
$comment = pb_backupbuddy::$classes['core']->normalize_comment_data($raw_comment);
$comment = $comment['note'];
// Check for DAT file.
pb_backupbuddy::status('details', 'Verifying DAT file in zip archive.');
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/backupbuddy_dat.php') === true) {
// Post 2.0 full backup
$status_details['found_dat'] = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/backupbuddy_dat.php') === true) {
// Pre 2.0 full backup
$status_details['found_dat'] = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'backupbuddy_dat.php') === true) {
// DB backup
$status_details['found_dat'] = true;
$backup_type = 'db';
}
// Check for DB SQL file.
pb_backupbuddy::status('details', 'Verifying database SQL file in zip archive.');
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/backupbuddy_temp/' . $serial . '/db_1.sql') === true) {
// post 2.0 full backup
$status_details['found_sql'] = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-content/uploads/temp_' . $serial . '/db.sql') === true) {
// pre 2.0 full backup
$status_details['found_sql'] = true;
$backup_type = 'full';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'db_1.sql') === true) {
// db only backup 2.0+
$status_details['found_sql'] = true;
$backup_type = 'db';
}
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'db.sql') === true) {
// db only backup pre-2.0
$status_details['found_sql'] = true;
$backup_type = 'db';
}
// Check for WordPress config file.
pb_backupbuddy::status('details', 'Verifying WordPress wp-config.php configuration file in zip archive.');
if (pb_backupbuddy::$classes['zipbuddy']->file_exists($file, 'wp-config.php') === true) {
$status_details['found_wpconfig'] = true;
$backup_type = 'full';
//.........这里部分代码省略.........