Make WordPress Core


Ignore:
Timestamp:
08/01/2008 05:00:07 AM (16 years ago)
Author:
ryan
Message:

HTTP POST and REQUEST API from jacobsantos. see #4779

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/cron.php

    r8514 r8516  
    7272}
    7373
     74/**
     75 * Send request to run cron through HTTP request that doesn't halt page loading.
     76 *
     77 * @since 2.1.0
     78 *
     79 * @return null CRON could not be spawned, because it is not needed to run.
     80 */
    7481function spawn_cron() {
    7582    $crons = _get_cron_array();
     
    8289        return;
    8390
    84     $cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
    85     $parts = parse_url( $cron_url );
     91    $cron_url = get_option( 'siteurl' ) . '/wp-cron.php?check=' . wp_hash('187425');
    8692
    87     if ($parts['scheme'] == 'https') {
    88         // support for SSL was added in 4.3.0
    89         if (version_compare(phpversion(), '4.3.0', '>=') && function_exists('openssl_open')) {
    90             $port = isset($parts['port']) ? $parts['port'] : 443;
    91             $argyle = @fsockopen('ssl://' . $parts['host'], $port, $errno, $errstr, 0.01);
    92         } else {
    93             return false;
    94         }
    95     } else {
    96         $port = isset($parts['port']) ? $parts['port'] : 80;
    97         $argyle = @ fsockopen( $parts['host'], $port, $errno, $errstr, 0.01 );
    98     }
    99 
    100     if ( $argyle )
    101         fputs( $argyle,
    102               "GET {$parts['path']}?check=" . wp_hash('187425') . " HTTP/1.0\r\n"
    103             . "Host: {$_SERVER['HTTP_HOST']}\r\n\r\n"
    104         );
     93    wp_remote_post($cron_url, array('timeout' => 0.01));
    10594}
    10695
Note: See TracChangeset for help on using the changeset viewer.