本文整理汇总了PHP中backupbuddy_core::verify_directories方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::verify_directories方法的具体用法?PHP backupbuddy_core::verify_directories怎么用?PHP backupbuddy_core::verify_directories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backupbuddy_core
的用法示例。
在下文中一共展示了backupbuddy_core::verify_directories方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run_periodic
public static function run_periodic($backup_age_limit = 172800, $die_on_fail = true)
{
if (is_multisite()) {
// For Multisite only run on main Network site.
if (!is_main_site()) {
return;
}
}
pb_backupbuddy::status('message', 'Starting periodic housekeeeping procedure for BackupBuddy v' . pb_backupbuddy::settings('version') . '.');
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
if (!isset(pb_backupbuddy::$options)) {
pb_backupbuddy::load();
}
// Top priority. Security related or otherwise crucial to run first.
self::no_recent_backup_reminder();
backupbuddy_core::verify_directories($skipTempGeneration = true);
// Verify directory existance and anti-directory browsing is in place everywhere.
self::check_high_security_mode($die_on_fail);
self::remove_importbuddy_file();
self::remove_importbuddy_dir();
self::remove_rollback_files();
// Potential large file/dir cleanup. May bog down site.
self::cleanup_temp_dir($backup_age_limit);
self::remove_temp_zip_dirs($backup_age_limit);
// Robustness -- handle re-processing timeouts, verifying schedules, etc.
self::process_timed_out_backups();
self::process_timed_out_sends();
self::validate_bb_schedules_in_wp();
// More minor cleanup.
self::remove_temp_tables();
self::remove_wp_schedules_with_no_bb_schedule();
self::trim_old_notifications();
self::trim_remote_send_stats();
self::s3_cancel_multipart_pieces();
self::s32_cancel_multipart_pieces();
self::cleanup_local_destination_temp();
self::purge_logs();
self::purge_large_logs();
self::clear_cron_send();
// PHP tests.
self::schedule_php_runtime_tests();
self::schedule_php_memory_tests();
@clearstatcache();
// Clears file info stat cache.
pb_backupbuddy::status('message', 'Finished periodic housekeeping cleanup procedure.');
}
示例2: unset
if ($multisite_option) {
$options = $multisite_option;
}
unset($multisite_option);
}
if ($options !== false) {
// If options is not false then we need to upgrade.
pb_backupbuddy::status('details', 'Migrating data structure. 2.x data discovered.');
backupbuddy_core::verify_directories();
require_once pb_backupbuddy::plugin_path() . '/controllers/activation.php';
}
unset($options);
// Check if data version is behind & run activation upgrades if needed.
$default_options = pb_backupbuddy::settings('default_options');
if (pb_backupbuddy::$options['data_version'] < $default_options['data_version']) {
backupbuddy_core::verify_directories();
pb_backupbuddy::status('details', 'Data structure version of `' . pb_backupbuddy::$options['data_version'] . '` behind current version of `' . $default_options['data_version'] . '`. Running activation upgrade.');
require_once pb_backupbuddy::plugin_path() . '/controllers/activation.php';
}
/* END HANDLING DATA STRUCTURE UPGRADE */
// Schedule daily housekeeping.
if (false === wp_next_scheduled(pb_backupbuddy::cron_tag('housekeeping'))) {
// if schedule does not exist...
backupbuddy_core::schedule_event(time() + 60 * 60 * 2, 'daily', pb_backupbuddy::cron_tag('housekeeping'), array());
// Add schedule.
}
/********** ACTIONS (admin) **********/
// Set up reminders if enabled.
if (pb_backupbuddy::$options['backup_reminders'] == '1') {
pb_backupbuddy::add_action(array('load-update-core.php', 'wp_update_backup_reminder'));
pb_backupbuddy::add_action(array('post_updated_messages', 'content_editor_backup_reminder_on_update'));
示例3: foreach
foreach (pb_backupbuddy::$options['remote_destinations'] as $destination_id => $destination) {
if ($destination['type'] == 'local' && (isset($destination['temporary']) && $destination['temporary'] === true)) {
// If local and temporary.
if (time() - $destination['created'] > $backup_age_limit) {
// Older than 12 hours; clear out!
pb_backupbuddy::status('details', 'Cleaned up stale local destination `' . $destination_id . '`.');
unset(pb_backupbuddy::$options['remote_destinations'][$destination_id]);
pb_backupbuddy::save();
}
}
}
// Cleanup excess remote sending stats.
pb_backupbuddy::status('details', 'Cleaning up remote send stats.');
backupbuddy_core::trim_remote_send_stats();
// Verify directory existance and anti-directory browsing is in place everywhere.
backupbuddy_core::verify_directories($skipTempGeneration = true);
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
// Mark any backups noted as in progress to timed out if taking too long. Send error email is scheduled and failed or timed out.
// Also, Purge fileoptions files without matching backup file in existance that are older than 30 days.
pb_backupbuddy::status('details', 'Cleaning up old backup fileoptions option files.');
$fileoptions_directory = backupbuddy_core::getLogDirectory() . 'fileoptions/';
$files = glob($fileoptions_directory . '*.txt');
if (!is_array($files)) {
$files = array();
}
foreach ($files as $file) {
pb_backupbuddy::status('details', 'Fileoptions instance #43.');
$backup_options = new pb_backupbuddy_fileoptions($file, $read_only = false);
if (true !== ($result = $backup_options->is_ok())) {
pb_backupbuddy::status('error', 'Error retrieving fileoptions file `' . $file . '`. Err 335353266.');
} else {
示例4: process_scheduled_backup
function process_scheduled_backup($cron_id)
{
if (!class_exists('backupbuddy_core')) {
require_once pb_backupbuddy::plugin_path() . '/classes/core.php';
}
if (!isset(pb_backupbuddy::$options)) {
$this->load();
}
// Verify directories.
backupbuddy_core::verify_directories($skipTempGeneration = true);
pb_backupbuddy::status('details', 'cron_process_scheduled_backup: ' . $cron_id);
$preflight_message = '';
$preflight_checks = backupbuddy_core::preflight_check();
foreach ($preflight_checks as $preflight_check) {
if ($preflight_check['success'] !== true) {
pb_backupbuddy::status('warning', $preflight_check['message']);
}
}
if (isset(pb_backupbuddy::$options['schedules'][$cron_id]) && is_array(pb_backupbuddy::$options['schedules'][$cron_id])) {
// If schedule is disabled then just return. Bail out!
if (isset(pb_backupbuddy::$options['schedules'][$cron_id]['on_off']) && pb_backupbuddy::$options['schedules'][$cron_id]['on_off'] == '0') {
pb_backupbuddy::status('message', 'Schedule `' . $cron_id . '` NOT run due to being disabled based on this schedule\'s settings.');
return;
}
pb_backupbuddy::$options['schedules'][$cron_id]['last_run'] = time();
// update last run time.
pb_backupbuddy::save();
if (!isset(pb_backupbuddy::$classes['backup'])) {
require_once pb_backupbuddy::plugin_path() . '/classes/backup.php';
pb_backupbuddy::$classes['backup'] = new pb_backupbuddy_backup();
}
if (pb_backupbuddy::$options['schedules'][$cron_id]['delete_after'] == '1') {
$delete_after = true;
pb_backupbuddy::status('details', 'Option to delete file after successful transfer enabled.');
} else {
$delete_after = false;
pb_backupbuddy::status('details', 'Option to delete file after successful transfer disabled.');
}
// If any remote destinations are set then add these to the steps to perform after the backup.
$post_backup_steps = array();
$destinations = explode('|', pb_backupbuddy::$options['schedules'][$cron_id]['remote_destinations']);
$found_valid_destination = false;
// Remove any invalid destinations from this run.
foreach ($destinations as $destination_index => $destination) {
if (!isset($destination) || $destination == '') {
// Remove.
unset($destinations[$destination_index]);
}
if (!isset(pb_backupbuddy::$options['remote_destinations'][$destination])) {
// Destination ID is invalid; remove.
unset($destinations[$destination_index]);
}
}
$destination_count = count($destinations);
$i = 0;
foreach ($destinations as $destination) {
$i++;
if ($i >= $destination_count) {
// Last destination. Delete after if enabled.
$this_delete_after = $delete_after;
pb_backupbuddy::status('details', 'Last destination set to send to so this file deletion will be determined by settings.');
} else {
// More destinations to send to. Only delete after final send.
$this_delete_after = false;
pb_backupbuddy::status('details', 'More destinations are set to send to so this file will not be deleted after send.');
}
$args = array($destination, $this_delete_after);
pb_backupbuddy::status('details', 'Adding send step with args `' . implode(',', $args) . '`.');
array_push($post_backup_steps, array('function' => 'send_remote_destination', 'args' => $args, 'start_time' => 0, 'finish_time' => 0, 'attempts' => 0));
$found_valid_destination = true;
pb_backupbuddy::status('details', 'Found valid destination.');
}
$profile_array = pb_backupbuddy::$options['profiles'][pb_backupbuddy::$options['schedules'][$cron_id]['profile']];
if (pb_backupbuddy::$classes['backup']->start_backup_process($profile_array, 'scheduled', array(), $post_backup_steps, pb_backupbuddy::$options['schedules'][$cron_id]['title']) !== true) {
pb_backupbuddy::status('error', 'Error #4564658344443: Backup failure. See earlier logging details for more information.');
}
}
pb_backupbuddy::status('details', 'Finished cron_process_scheduled_backup.');
}
示例5: pre_backup
function pre_backup($serial, $archiveFile, $profile, $trigger, $pre_backup = array(), $post_backup = array(), $schedule_title = '', $export_plugins = array(), $deployDirection, $deployDestinationSettings)
{
pb_backupbuddy::status('startFunction', json_encode(array('function' => 'pre_backup', 'title' => 'Getting ready to backup')));
$type = $profile['type'];
// Log some status information.
pb_backupbuddy::status('details', __('Performing pre-backup procedures.', 'it-l10n-backupbuddy'));
if ($type == 'full') {
pb_backupbuddy::status('message', __('Full backup mode.', 'it-l10n-backupbuddy'));
} elseif ($type == 'db') {
pb_backupbuddy::status('message', __('Database only backup mode.', 'it-l10n-backupbuddy'));
} elseif ($type == 'files') {
pb_backupbuddy::status('message', __('Files only backup mode.', 'it-l10n-backupbuddy'));
//$profile['skip_database_dump'] = '1';
} elseif ($type == 'export') {
pb_backupbuddy::status('message', __('Multisite subsite export mode.', 'it-l10n-backupbuddy'));
} else {
pb_backupbuddy::status('error', 'Error #8587383: Unknown backup mode `' . htmlentities($type) . '`.');
}
if ('' != $deployDirection) {
pb_backupbuddy::status('details', 'Deployment direction: `' . $deployDirection . '`.');
}
if ('1' == pb_backupbuddy::$options['prevent_flush']) {
pb_backupbuddy::status('details', 'Flushing will be skipped based on advanced settings.');
} else {
pb_backupbuddy::status('details', 'Flushing will not be skipped (default).');
}
// Schedule daily housekeeping.
if (false === wp_next_scheduled(pb_backupbuddy::cron_tag('housekeeping'))) {
// if schedule does not exist...
backupbuddy_core::schedule_event(time() + 60 * 60 * 2, 'daily', pb_backupbuddy::cron_tag('housekeeping'), array());
// Add schedule.
}
// Verify directories.
pb_backupbuddy::status('details', 'Verifying directories ...');
if (false === backupbuddy_core::verify_directories()) {
pb_backupbuddy::status('error', 'Error #18573. Error verifying directories. See details above. Backup halted.');
pb_backupbuddy::status('haltScript', '');
// Halt JS on page.
die;
} else {
pb_backupbuddy::status('details', 'Directories verified.');
}
// Delete all backup archives if this troubleshooting option is enabled.
if (pb_backupbuddy::$options['delete_archives_pre_backup'] == '1') {
pb_backupbuddy::status('message', 'Deleting all existing backups prior to backup as configured on the settings page.');
$file_list = glob(backupbuddy_core::getBackupDirectory() . 'backup*.zip');
if (is_array($file_list) && !empty($file_list)) {
foreach ($file_list as $file) {
if (@unlink($file) === true) {
pb_backupbuddy::status('details', 'Deleted backup archive `' . basename($file) . '` based on settings to delete all backups.');
} else {
pb_backupbuddy::status('details', 'Unable to delete backup archive `' . basename($file) . '` based on settings to delete all backups. Verify permissions.');
}
}
}
}
// Generate unique serial ID.
pb_backupbuddy::status('details', 'Backup serial generated: `' . $serial . '`.');
pb_backupbuddy::status('details', 'About to load fileoptions data in create mode.');
require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
pb_backupbuddy::status('details', 'Fileoptions instance #40.');
$this->_backup_options = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'fileoptions/' . $serial . '.txt', $read_only = false, $ignore_lock = false, $create_file = true);
if (true !== ($result = $this->_backup_options->is_ok())) {
pb_backupbuddy::status('error', __('Fatal Error #9034 A. Unable to access fileoptions data.', 'it-l10n-backupbuddy') . ' Error: ' . $result);
pb_backupbuddy::status('haltScript', '');
// Halt JS on page.
return false;
}
pb_backupbuddy::status('details', 'Fileoptions data loaded.');
$this->_backup =& $this->_backup_options->options;
// Set reference.
// Cleanup internal stats. Deployments should not impact stats.
if ('' == $deployDirection) {
pb_backupbuddy::status('details', 'Updating statistics for last backup start.');
pb_backupbuddy::$options['last_backup_start'] = time();
// Reset time since last backup.
pb_backupbuddy::$options['last_backup_serial'] = $serial;
pb_backupbuddy::save();
}
// Output active plugins list for debugging...
$activePlugins = get_option('active_plugins');
pb_backupbuddy::status('details', 'Active WordPress plugins: `' . implode('; ', $activePlugins) . '`.');
pb_backupbuddy::status('startSubFunction', json_encode(array('function' => 'wp_plugins_found', 'title' => 'Found ' . count($activePlugins) . ' active WordPress plugins.')));
unset($activePlugins);
// Compression to bool.
/*
if ( $profile['compression'] == '1' ) {
$profile['compression'] = true;
} else {
$profile['compression'] = false;
}
*/
if (pb_backupbuddy::$options['compression'] == '1') {
$compression = true;
} else {
$compression = false;
}
$archiveURL = '';
$abspath = str_replace('\\', '/', ABSPATH);
// Change slashes to handle Windows as we store backup_directory with Linux-style slashes even on Windows.
//.........这里部分代码省略.........
示例6: admin_notices
function admin_notices()
{
backupbuddy_core::verify_directories($skipTempGeneration = true);
}