当前位置: 首页>>代码示例>>PHP>>正文


PHP backupbuddy_core::unschedule_event方法代码示例

本文整理汇总了PHP中backupbuddy_core::unschedule_event方法的典型用法代码示例。如果您正苦于以下问题:PHP backupbuddy_core::unschedule_event方法的具体用法?PHP backupbuddy_core::unschedule_event怎么用?PHP backupbuddy_core::unschedule_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backupbuddy_core的用法示例。


在下文中一共展示了backupbuddy_core::unschedule_event方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 if (defined('PB_DEMO_MODE')) {
     pb_backupbuddy::alert('Access denied in demo mode.', true);
 } else {
     $delete_items = pb_backupbuddy::_POST('items');
     $deleted_crons = array();
     // For listing in alert.
     foreach ($delete_items as $delete_item) {
         $cron_parts = explode('|', $delete_item);
         $timestamp = $cron_parts[0];
         $cron_hook = $cron_parts[1];
         $cron_key = $cron_parts[2];
         if (isset($cron[$timestamp][$cron_hook][$cron_key])) {
             // Run cron.
             $cron_array = $cron[$timestamp][$cron_hook][$cron_key];
             // Get cron array based on passed values.
             $result = backupbuddy_core::unschedule_event($timestamp, $cron_hook, $cron_array['args']);
             // Delete the scheduled cron.
             if ($result === FALSE) {
                 pb_backupbuddy::alert('Error #5657667675. Unable to delete CRON job. Please see your BackupBuddy error log for details.');
             }
             $deleted_crons[] = $cron_hook . ' / ' . $cron_key;
             // Add deleted cron to list of deletions for display.
         } else {
             // Cron not found, error.
             pb_backupbuddy::alert('Invalid CRON job. Not found.', true);
         }
     }
     pb_backupbuddy::alert(__('Deleted sheduled CRON event(s):', 'it-l10n-backupbuddy') . '<br>' . implode('<br>', $deleted_crons));
     $cron = get_option('cron');
     // Reset to most up to date status for cron listing below. Takes into account deletions.
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:cron.php

示例2: foreach

     foreach ((array) $event as $item_name => $item) {
         if ('pb_backupbuddy-cron_scheduled_backup' == $hook_name) {
             // scheduled backup
             if (!empty($item['args'])) {
                 if (!isset(pb_backupbuddy::$options['schedules'][$item['args'][0]])) {
                     // BB schedule does not exist so delete this cron item.
                     if (FALSE === backupbuddy_core::unschedule_event($time, $hook_name, $item['args'])) {
                         // Delete the scheduled cron.
                         pb_backupbuddy::status('error', 'Error #5657667675b. Unable to delete CRON job. Please see your BackupBuddy error log for details.');
                     } else {
                         pb_backupbuddy::status('details', 'Removed stale cron scheduled backup.');
                     }
                 }
             } else {
                 // No args, something wrong so delete it.
                 if (FALSE === backupbuddy_core::unschedule_event($time, $hook_name, $item['args'])) {
                     // Delete the scheduled cron.
                     pb_backupbuddy::status('error', 'Error #5657667675c. Unable to delete CRON job. Please see your BackupBuddy error log for details.');
                 } else {
                     pb_backupbuddy::status('details', 'Removed stale cron scheduled backup which had no arguments.');
                 }
             }
         }
     }
     // End foreach.
     unset($item);
     unset($item_name);
 }
 // End foreach.
 unset($event);
 unset($hook_name);
开发者ID:Offirmo,项目名称:base-wordpress,代码行数:31,代码来源:_periodicCleanup.php

示例3: validateSchedules

 public static function validateSchedules()
 {
     foreach (pb_backupbuddy::$options['schedules'] as $schedule_id => $schedule) {
         // Retrieve current interval WordPress cron thinks the schedule is at.
         $cron_inverval = wp_get_schedule('pb_backupbuddy-cron_scheduled_backup', array((int) $schedule_id));
         $intervals = wp_get_schedules();
         if (FALSE === $cron_inverval) {
             // Schedule MISSING. Re-schedule.
             $result = backupbuddy_core::schedule_event($schedule['first_run'], $schedule['interval'], 'pb_backupbuddy-cron_scheduled_backup', array((int) $schedule_id));
             // Add new schedule.
             if ($result === FALSE) {
                 $message = 'Error #83443784: A missing schedule was identified but unable to be re-created. Your schedule may not work properly & need manual attention.';
                 pb_backupbuddy::alert($message, true);
             } else {
                 pb_backupbuddy::alert('Warning #2389373: A missing schedule was identified and re-created. This should have corrected any problem with this schedule.', true);
             }
             continue;
         }
         if ($cron_inverval != $schedule['interval']) {
             // Schedule exists BUT interval is WRONG. Fix it.
             $cron_run = wp_next_scheduled('pb_backupbuddy-cron_scheduled_backup', array((int) $schedule_id));
             $result = backupbuddy_core::unschedule_event($cron_run, 'pb_backupbuddy-cron_scheduled_backup', array((int) $schedule_id));
             // Delete existing schedule.
             if ($result === FALSE) {
                 $message = 'Error removing invalid event from WordPress. Your schedule may not work properly. Please try again. Error #38279343. Check your BackupBuddy error log for details.';
                 pb_backupbuddy::alert($message, true);
                 continue;
             }
             // Determine when the next run time SHOULD be.
             if (0 == $schedule['last_run']) {
                 $next_run = $schedule['first_run'];
             } else {
                 $next_run = (int) $schedule['last_run'] + (int) $intervals[$schedule['interval']]['interval'];
             }
             $result = backupbuddy_core::schedule_event($next_run, $schedule['interval'], 'pb_backupbuddy-cron_scheduled_backup', array((int) $schedule_id));
             // Add new schedule.
             if ($result === FALSE) {
                 $message = 'Error #237836464: An invalid schedule with the incorrect interval was identified & deleted but unable to be re-created. Your schedule may not work properly & need manual attention.';
                 pb_backupbuddy::alert($message, true);
                 continue;
             } else {
                 pb_backupbuddy::alert('Warning #2423484: An invalid schedule with the incorrect interval was identified and updated. This should have corrected any problem with this schedule.', true);
             }
         }
     }
     // end foreach.
     //wp_get_schedule($hook, $args = array())
 }
开发者ID:bunnywong,项目名称:freshlinker,代码行数:48,代码来源:core.php

示例4: htmlentities

                pb_backupbuddy::save();
                $schedule_form->clear_values();
                pb_backupbuddy::alert('Added new schedule `' . htmlentities($submitted_schedule['data']['title']) . '`.');
            }
        }
    } else {
        // EDIT SCHEDULE. Form handles saving; just need to update timestamp.
        $first_run = pb_backupbuddy::$format->unlocalize_time(strtotime($submitted_schedule['data']['first_run']));
        if ($first_run == 0 || $first_run == 18000) {
            pb_backupbuddy::alert(sprintf(__('Invalid time format. Please use the specified format / example %s', 'it-l10n-backupbuddy'), $date_format_example));
            $error = true;
        }
        pb_backupbuddy::$options['schedules'][pb_backupbuddy::_GET('edit')]['first_run'] = $first_run;
        //echo 'first: ' . $first_run;
        $next_scheduled_time = wp_next_scheduled('pb_backupbuddy-cron_scheduled_backup', array((int) $_GET['edit']));
        $result = backupbuddy_core::unschedule_event($next_scheduled_time, 'pb_backupbuddy-cron_scheduled_backup', array((int) $_GET['edit']));
        // Remove old schedule. pb_backupbuddy::$options['schedules'][$_GET['edit']]['first_run']
        if ($result === FALSE) {
            pb_backupbuddy::alert('Error #589689. Unable to unschedule scheduled cron job with WordPress. Please see your BackupBuddy error log for details.');
        }
        $result = backupbuddy_core::schedule_event($first_run, $submitted_schedule['data']['interval'], 'pb_backupbuddy-cron_scheduled_backup', array((int) $_GET['edit']));
        // Add new schedule.
        if ($result === FALSE) {
            pb_backupbuddy::alert('Error scheduling event with WordPress. Your schedule may not work properly. Please try again. Error #3488439. Check your BackupBuddy error log for details.', true);
        }
        pb_backupbuddy::save();
        pb_backupbuddy::alert('Edited schedule `' . htmlentities($submitted_schedule['data']['title']) . '`.');
    }
} elseif (count($submitted_schedule['errors']) > 0) {
    foreach ($submitted_schedule['errors'] as $error) {
        pb_backupbuddy::alert($error);
开发者ID:arobbins,项目名称:iab,代码行数:31,代码来源:scheduling.php

示例5: wp_next_scheduled

<?php

if (true !== $confirm) {
    return false;
}
$next_scheduled_time = wp_next_scheduled('pb_backupbuddy-cron_scheduled_backup', array((int) $scheduleID));
if (FALSE === backupbuddy_core::unschedule_event($next_scheduled_time, 'pb_backupbuddy-cron_scheduled_backup', array((int) $scheduleID))) {
    return false;
}
$deletedSchedule = pb_backupbuddy::$options['schedules'][$scheduleID];
unset(pb_backupbuddy::$options['schedules'][$scheduleID]);
pb_backupbuddy::save();
backupbuddy_core::addNotification('schedule_deleted', 'Backup schedule deleted', 'An existing backup schedule "' . $deletedSchedule['title'] . '" has been deleted.', $deletedSchedule);
return true;
开发者ID:elephantcode,项目名称:elephantcode,代码行数:14,代码来源:_deleteSchedule.php

示例6: remove_wp_schedules_with_no_bb_schedule

 public static function remove_wp_schedules_with_no_bb_schedule()
 {
     $cron = get_option('cron');
     foreach ((array) $cron as $time => $cron_item) {
         // Times
         if (is_numeric($time)) {
             // Loop through each schedule for this time
             foreach ((array) $cron_item as $hook_name => $event) {
                 // Methods
                 foreach ((array) $event as $item_name => $item) {
                     // Full args for method
                     if ('backupbuddy_cron' == $hook_name && 'run_scheduled_backup' == $item['args'][0]) {
                         // scheduled backup
                         if (!empty($item['args'])) {
                             if (!isset(pb_backupbuddy::$options['schedules'][$item['args'][1][0]])) {
                                 // BB schedule does not exist so delete this cron item.
                                 if (FALSE === backupbuddy_core::unschedule_event($time, $hook_name, $item['args'])) {
                                     // Delete the scheduled cron.
                                     pb_backupbuddy::status('error', 'Error #5657667675b. Unable to delete CRON job. Please see your BackupBuddy error log for details.');
                                 } else {
                                     pb_backupbuddy::status('warning', 'Removed stale cron scheduled backup.');
                                 }
                             }
                         } else {
                             // No args, something wrong so delete it.
                             if (FALSE === backupbuddy_core::unschedule_event($time, $hook_name, $item['args'])) {
                                 // Delete the scheduled cron.
                                 pb_backupbuddy::status('error', 'Error #5657667675c. Unable to delete CRON job. Please see your BackupBuddy error log for details.');
                             } else {
                                 pb_backupbuddy::status('warning', 'Removed stale cron scheduled backup which had no arguments.');
                             }
                         }
                     } elseif ('pb_backupbuddy-cron_scheduled_backup' == $hook_name) {
                         // Upgrade hook name to 'backupbuddy_cron'.
                         if (FALSE === wp_unschedule_event($time, $hook_name, $item['args'])) {
                             // Delete the scheduled cron.
                             pb_backupbuddy::status('error', 'Error #327237. Unable to delete CRON job for migration to new tag. Please see your BackupBuddy error log for details.');
                         } else {
                             pb_backupbuddy::status('details', 'Removed cron with old tag format.');
                         }
                         if (isset(pb_backupbuddy::$options['schedules'][$item['args'][0]])) {
                             // BB schedule exists so recreate.
                             $result = backupbuddy_core::schedule_event($time, pb_backupbuddy::$options['schedules'][$item['args'][0]]['interval'], 'run_scheduled_backup', $item['args']);
                             if ($result === false) {
                                 pb_backupbuddy::status('error', 'Error #8923832: Unable to reschedule with new cron tag.');
                             } else {
                                 pb_backupbuddy::status('details', 'Replaced cron with old tag format with new format.');
                             }
                         } else {
                             pb_backupbuddy::status('warning', 'Stale schedule found with WordPress without corresponding BackupBuddy schedule. Not keeping when migrating to new cron tag.');
                         }
                     } elseif ('pb_backupbuddy_cron' == $hook_name) {
                         // Remove.
                         wp_unschedule_event($time, $hook_name, $item['args']);
                     } elseif ('pb_backupbuddy_corn' == $hook_name) {
                         // Remove.
                         wp_unschedule_event($time, $hook_name, $item['args']);
                     } elseif ('pb_backupbuddy_housekeeping' == $hook_name) {
                         // Remove.
                         wp_unschedule_event($time, $hook_name, $item['args']);
                     }
                 }
                 // End foreach.
                 unset($item);
                 unset($item_name);
             }
             // End foreach.
             unset($event);
             unset($hook_name);
         }
         // End if is_numeric.
     }
     // End foreach.
     unset($cron_item);
     unset($time);
 }
开发者ID:arobbins,项目名称:spellestate,代码行数:76,代码来源:housekeeping.php


注:本文中的backupbuddy_core::unschedule_event方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。