本文整理汇总了PHP中backupbuddy_core::backup_integrity_check方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::backup_integrity_check方法的具体用法?PHP backupbuddy_core::backup_integrity_check怎么用?PHP backupbuddy_core::backup_integrity_check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::backup_integrity_check方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: backups_list
public static function backups_list($type = 'default', $subsite_mode = false)
{
if (pb_backupbuddy::_POST('bulk_action') == 'delete_backup' && is_array(pb_backupbuddy::_POST('items'))) {
$needs_save = false;
pb_backupbuddy::verify_nonce(pb_backupbuddy::_POST('_wpnonce'));
// Security check to prevent unauthorized deletions by posting from a remote place.
$deleted_files = array();
foreach (pb_backupbuddy::_POST('items') as $item) {
if (file_exists(backupbuddy_core::getBackupDirectory() . $item)) {
if (@unlink(backupbuddy_core::getBackupDirectory() . $item) === true) {
$deleted_files[] = $item;
// Cleanup any related fileoptions files.
$serial = backupbuddy_core::get_serial_from_file($item);
$backup_files = glob(backupbuddy_core::getBackupDirectory() . '*.zip');
if (!is_array($backup_files)) {
$backup_files = array();
}
if (count($backup_files) > 5) {
// Keep a minimum number of backups in array for stats.
$this_serial = self::get_serial_from_file($item);
$fileoptions_file = backupbuddy_core::getLogDirectory() . 'fileoptions/' . $this_serial . '.txt';
if (file_exists($fileoptions_file)) {
@unlink($fileoptions_file);
}
if (file_exists($fileoptions_file . '.lock')) {
@unlink($fileoptions_file . '.lock');
}
$needs_save = true;
}
} else {
pb_backupbuddy::alert('Error: Unable to delete backup file `' . $item . '`. Please verify permissions.', true);
}
}
// End if file exists.
}
// End foreach.
if ($needs_save === true) {
pb_backupbuddy::save();
}
pb_backupbuddy::alert(__('Deleted:', 'it-l10n-backupbuddy') . ' ' . implode(', ', $deleted_files));
}
// End if deleting backup(s).
$backups = array();
$backup_sort_dates = array();
$files = glob(backupbuddy_core::getBackupDirectory() . 'backup*.zip');
if (is_array($files) && !empty($files)) {
// For robustness. Without open_basedir the glob() function returns an empty array for no match. With open_basedir in effect the glob() function returns a boolean false for no match.
$backup_prefix = self::backup_prefix();
// Backup prefix for this site. Used for MS checking that this user can see this backup.
foreach ($files as $file_id => $file) {
if ($subsite_mode === true && is_multisite()) {
// If a Network and NOT the superadmin must make sure they can only see the specific subsite backups for security purposes.
// Only allow viewing of their own backups.
if (!strstr($file, $backup_prefix)) {
unset($files[$file_id]);
// Remove this backup from the list. This user does not have access to it.
continue;
// Skip processing to next file.
}
}
$serial = backupbuddy_core::get_serial_from_file($file);
$options = array();
if (file_exists(backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt')) {
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #33.');
$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.
} else {
$backup_options = '';
}
$backup_integrity = backupbuddy_core::backup_integrity_check($file, $backup_options, $options);
// Backup status.
$pretty_status = array(true => '<span class="pb_label pb_label-success">Good</span>', 'pass' => '<span class="pb_label pb_label-success">Good</span>', false => '<span class="pb_label pb_label-important">Bad</span>', 'fail' => '<span class="pb_label pb_label-important">Bad</span>');
// Backup type.
$pretty_type = array('full' => 'Full', 'db' => 'Database', 'files' => 'Files');
// Defaults...
$detected_type = '';
$file_size = '';
$modified = '';
$modified_time = 0;
$integrity = '';
$main_string = 'Warn#284.';
if (is_array($backup_integrity)) {
// Data intact... put it all together.
// Calculate time ago.
$time_ago = '';
if (isset($backup_integrity['modified'])) {
$time_ago = pb_backupbuddy::$format->time_ago($backup_integrity['modified']) . ' ago';
}
$detected_type = pb_backupbuddy::$format->prettify($backup_integrity['detected_type'], $pretty_type);
if ($detected_type == '') {
$detected_type = 'Unknown';
} else {
if (isset($backup_options->options['profile'])) {
$detected_type = '
<div>
<span style="color: #AAA; float: left;">' . $detected_type . '</span>
<span style="display: inline-block; float: left; height: 15px; border-right: 1px solid #EBEBEB; margin-left: 6px; margin-right: 6px;"></span>
' . htmlentities($backup_options->options['profile']['title']) . '
</div>
//.........这里部分代码省略.........
示例2: integrity_check
function integrity_check()
{
pb_backupbuddy::status('milestone', 'start_integrity');
pb_backupbuddy::status('message', __('Scanning and verifying backup file integrity.', 'it-l10n-backupbuddy'));
if ($this->_backup['profile']['type'] != 'files' && $this->_backup['profile']['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 caution!');
}
$options = array('skip_database_dump' => $this->_backup['profile']['skip_database_dump']);
pb_backupbuddy::status('details', 'Starting integrity check on `' . $this->_backup['archive_file'] . '`.');
$result = backupbuddy_core::backup_integrity_check($this->_backup['archive_file'], $this->_backup_options, $options, $skipLogRedirect = true);
if (false === $result['is_ok']) {
$message = __('Backup failed to pass integrity check. The backup may have failed OR the backup may be valid but the integrity check could not verify it. This could be due to permissions, large file size, running out of memory, or other error. Verify you have not excluded one or more required files, paths, or database tables; check for warnings above in the status log. You may wish to manually verify the backup file is functional or re-scan.', 'it-l10n-backupbuddy');
pb_backupbuddy::status('error', $message);
pb_backupbuddy::status('details', 'Running cleanup procedure now in current step as backup procedure is halting.');
$this->post_backup(true);
// Post backup cleanup in fail mode.
//pb_backupbuddy::status( 'haltScript', '' ); // Halt JS on page.
pb_backupbuddy::status('details', __('Sending integrity check failure email.', 'it-l10n-backupbuddy'));
backupbuddy_core::mail_error($message);
return false;
}
pb_backupbuddy::status('milestone', 'finish_integrity');
return true;
}