Skip to:
Content

bbPress.org

Changeset 1923


Ignore:
Timestamp:
01/23/2009 12:24:07 AM (17 years ago)
Author:
sambauers
Message:

Change callback reference to cron rescheduler. Fixes #1034. Props Nightgunner5. Also some coding standards cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-cron.php

    r1857 r1923  
    1010 */
    1111
    12 ignore_user_abort(true);
     12ignore_user_abort( true );
    1313
    1414/**
     
    1717 * @var bool
    1818 */
    19 define('DOING_CRON', true);
     19define( 'DOING_CRON', true );
    2020
    2121/** Setup bbPress environment */
    22 require_once('./bb-load.php');
     22require_once( './bb-load.php' );
    2323
    24 if ( $_GET['check'] != backpress_get_option('cron_check') )
     24if ( $_GET['check'] != backpress_get_option( 'cron_check' ) ) {
    2525    exit;
     26}
    2627
    27 if ( bb_get_option('doing_cron') > time() )
     28if ( bb_get_option( 'doing_cron' ) > time() ) {
    2829    exit;
     30}
    2931
    30 bb_update_option('doing_cron', time() + 30);
     32bb_update_option( 'doing_cron', time() + 30 );
    3133
    3234$crons = _get_cron_array();
    33 $keys = array_keys($crons);
    34 if (!is_array($crons) || $keys[0] > time())
     35$keys = array_keys( $crons );
     36if ( !is_array( $crons ) || $keys[0] > time() ) {
    3537    return;
     38}
    3639
    37 foreach ($crons as $timestamp => $cronhooks) {
    38     if ($timestamp > time()) break;
    39     foreach ($cronhooks as $hook => $keys) {
    40         foreach ($keys as $key => $args) {
     40foreach ( $crons as $timestamp => $cronhooks ) {
     41    if ( $timestamp > time() ) {
     42        break;
     43    }
     44    foreach ( $cronhooks as $hook => $keys ) {
     45        foreach ( $keys as $key => $args ) {
    4146            $schedule = $args['schedule'];
    42             if ($schedule != false) {
    43                 $new_args = array($timestamp, $schedule, $hook, $args['args']);
    44                 call_user_func_array(array('BB_Cron', 'reschedule_event'), $new_args);
     47            if ( $schedule != false ) {
     48                $new_args = array( $timestamp, $schedule, $hook, $args['args'] );
     49                call_user_func_array( 'wp_reschedule_event' , $new_args );
    4550            }
    46             wp_unschedule_event($timestamp, $hook, $args['args']);
    47             do_action_ref_array($hook, $args['args']);
     51            wp_unschedule_event( $timestamp, $hook, $args['args'] );
     52            do_action_ref_array( $hook, $args['args'] );
    4853        }
    4954    }
    5055}
    5156
    52 bb_update_option('doing_cron', 0);
    53 
    54 ?>
     57bb_update_option( 'doing_cron', 0 );
Note: See TracChangeset for help on using the changeset viewer.