Make WordPress Core

Ticket #12609: 12609.diff

File 12609.diff, 2.2 KB (added by sivel, 15 years ago)

Use wp_remote_head instead of wp_remote_post with empty body and switch default for sslverify to false

  • wp-includes/cron.php

     
    177177        if ( !$local_time )
    178178                $local_time = time();
    179179
    180         if ( defined('DOING_CRON') || isset($_GET['doing_wp_cron']) )
     180        if ( defined( 'DOING_CRON' ) || isset( $_GET['doing_wp_cron'] ) )
    181181                return;
    182182
    183183        /*
     
    185185         * such as due to power failure, or misconfiguration
    186186         */
    187187        $timer_accurate = check_server_timer( $local_time );
    188         if ( !$timer_accurate )
     188        if ( ! $timer_accurate )
    189189                return;
    190190
    191191        /*
    192192        * multiple processes on multiple web servers can run this code concurrently
    193193        * try to make this as atomic as possible by setting doing_cron switch
    194194        */
    195         $flag = get_transient('doing_cron');
     195        $flag = get_transient( 'doing_cron' );
    196196
    197197        if ( $flag > $local_time + 10*60 )
    198198                $flag = 0;
     
    203203
    204204        //sanity check
    205205        $crons = _get_cron_array();
    206         if ( !is_array($crons) )
     206        if ( ! is_array( $crons ) )
    207207                return;
    208208
    209209        $keys = array_keys( $crons );
    210         if ( isset($keys[0]) && $keys[0] > $local_time )
     210        if ( isset( $keys[0] ) && $keys[0] > $local_time )
    211211                return;
    212212
    213         if ( defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON ) {
    214                 if ( !empty($_POST) || defined('DOING_AJAX') )
     213        if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
     214                if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) )
    215215                        return;
    216216
    217217                set_transient( 'doing_cron', $local_time );
    218218
    219219                ob_start();
    220                 wp_redirect( add_query_arg('doing_wp_cron', '', stripslashes($_SERVER['REQUEST_URI'])) );
     220                wp_redirect( add_query_arg( 'doing_wp_cron', '', stripslashes( $_SERVER['REQUEST_URI'] ) ) );
    221221                echo ' ';
    222222
    223223                // flush any buffers and send the headers
    224224                while ( @ob_end_flush() );
    225225                flush();
    226226
    227                 @include_once(ABSPATH . 'wp-cron.php');
     227                @include_once( ABSPATH . 'wp-cron.php' );
    228228                return;
    229229        }
    230230
    231231        set_transient( 'doing_cron', $local_time );
    232232
    233233        $cron_url = get_option( 'siteurl' ) . '/wp-cron.php?doing_wp_cron';
    234         wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters('https_local_ssl_verify', true)) );
     234        wp_remote_head( $cron_url, array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', false ) ) );
    235235}
    236236
    237237/**