Make WordPress Core

Ticket #25475: cron-2.diff

File cron-2.diff, 5.6 KB (added by tmtoy, 12 years ago)

Fixed mistake /wp-includes/cron.php

  • src/wp-includes/cron.php

     
    2626                return;
    2727
    2828        $crons = _get_cron_array();
    29         $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args );
    30         $event = apply_filters('schedule_event', $event);
     29        $event = clone (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => false, 'args' => $args );
     30        /**
     31         * Filter is fired when a new event is added to the cron schedule.
     32         *
     33         * @since 3.1.0
     34         *
     35         * @param array(object) $event {
     36         *    The event being scheduled as on object with the following properties: hook, timestamp, schedule, args.
     37         *
     38         *    @type int    $timestamp  The first time that you want the event to occur.
     39         *    @type string $recurrence How often the event should reoccur.
     40         *    @type string $hook       The name of an action hook to execute.
     41         *    @type array  $args       Arguments to pass to the hook function(s).
     42         * }
     43         */
     44        $event = apply_filters( 'schedule_event', $event );
    3145
    3246        // A plugin disallowed this event
    3347        if ( ! $event )
     
    6882                return false;
    6983
    7084        $event = (object) array( 'hook' => $hook, 'timestamp' => $timestamp, 'schedule' => $recurrence, 'args' => $args, 'interval' => $schedules[$recurrence]['interval'] );
    71         $event = apply_filters('schedule_event', $event);
     85        // duplicate_hook
     86        $event = apply_filters( 'schedule_event', $event );
    7287
    7388        // A plugin disallowed this event
    7489        if ( ! $event )
     
    243258
    244259        $doing_wp_cron = sprintf( '%.22F', $gmt_time );
    245260        set_transient( 'doing_cron', $doing_wp_cron );
     261        /**
     262         * Filter whether to SSL verify the cron request.
     263         *
     264         * @since 2.8.0
     265         *
     266         * @type bool Default true(check), false(not check) Check to SecureSocketsLayer.
     267        */
     268        $args_apply_filters = apply_filters( 'https_local_ssl_verify', TRUE );
     269        $cron_request_array = array(
     270            'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ),
     271            'key' => $doing_wp_cron,
     272            'args' => array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => $args_apply_filters )
     273        );
     274        /**
     275         * Filter the cron_url in wp_remote_post().
     276         *
     277         * @since 3.5.0
     278         *
     279         * @param array $cron_request_array {
     280         *    Set the cron_url (URL, key, time to timeout, whether to blocking and chekck to SSL).
     281         *
     282         *    @type string url SiteURL/wp-crom.php?doing_wp_cron="22 digit gmt microtime".
     283         *    @type int    key 22 digit gmt microtime.
     284         *    @type array  args {
     285         *        @type int  timeout                                                         Time to Timeout.
     286         *        @type bool blocking            Default false(blocking), true(not blocking) Whether to blocking.
     287         *        @type bool $args_apply_filters Default true(check), false(not check)       Check to SecureSocketsLayer.
     288         *    }
     289         * }
     290         */
     291        $cron_request = apply_filters( 'cron_request', $cron_request_array );
    246292
    247         $cron_request = apply_filters( 'cron_request', array(
    248                 'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ),
    249                 'key' => $doing_wp_cron,
    250                 'args' => array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) )
    251         ) );
    252 
    253293        wp_remote_post( $cron_request['url'], $cron_request['args'] );
    254294}
    255295
     
    317357 * @return array
    318358 */
    319359function wp_get_schedules() {
    320         $schedules = array(
    321                 'hourly'     => array( 'interval' => HOUR_IN_SECONDS,      'display' => __( 'Once Hourly' ) ),
    322                 'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ) ),
    323                 'daily'      => array( 'interval' => DAY_IN_SECONDS,       'display' => __( 'Once Daily' ) ),
    324         );
    325         return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
     360        $interval   = array(
     361                'hourly'     => HOUR_IN_SECONDS,
     362                'twicedaily' => 12 * HOUR_IN_SECONDS,
     363                'daily'      => DAY_IN_SECONDS
     364        );
     365        $display    = array(
     366                'hourly'     => __( 'Once Hourly' ),
     367                'twicedaily' => __( 'Twice Daily' ),
     368                'daily'      => __( 'Once Daily' )
     369        );
     370        $hourly     = array( $interval['hourly'], $display['hourly'] );
     371        $twicedaily = array( $interval['twicedaily'], $display['twicedaily'] );
     372        $daily      = array( $interval['daily'], $display['daily'] );
     373        $schedules  = array(
     374                'hourly'     => $hourly,
     375                'twicedaily' => $twicedaily,
     376                'daily'      => $daily
     377        );
     378        /**
     379         * Filter the plugin to generate cron schedules in the wp_get_schedules function.
     380         *
     381         * @since 2.1.0
     382         *
     383         * @param array $schedules {
     384         *    The value is an array with two keys,'interval' and 'display'.
     385         *
     386         *    @type array 'hourly' {
     387         *        @type int    $interval The 'interval' is a number in seconds of when the cron job should run.
     388         *        @type string $display  The 'display' is the label name for this schedule.
     389         *    }
     390         *    @type array 'twicedaily' {
     391         *        @type int    $interval The 'interval' is a number in seconds of when the cron job should run.
     392         *        @type string $display  The 'display' is the label name for this schedule.
     393         *    }
     394         *    @type array 'daily' {
     395         *        @type int    $interval The 'interval' is a number in seconds of when the cron job should run.
     396         *        @type string $display  The 'display' is the label name for this schedule.
     397         *    }
     398         * }
     399         */
     400        $array_merge = array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
     401        return $array_merge;
    326402}
    327403
    328404/**