Make WordPress Core


Ignore:
Timestamp:
01/31/2009 02:23:24 AM (16 years ago)
Author:
azaozz
Message:

Spawn cron with AJAX request, see #9005

File:
1 edited

Legend:

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

    r10473 r10474  
    181181        return;
    182182
    183     $cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
    184183    /*
    185184    * multiple processes on multiple web servers can run this code concurrently
     
    202201    update_option( 'doing_cron', $local_time + 30 );
    203202
    204     wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' => false));
     203    add_action('wp_head', 'spawn_cron_request');
    205204}
    206205
     
    372371}
    373372
     373function spawn_cron_request() {
    374374?>
     375<script type="text/javascript">
     376/* <![CDATA[ */
     377window.setTimeout(function(){var x;if(window.XMLHttpRequest){x=new XMLHttpRequest();}else{try{x=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{x=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){};}}if(x){x.open('GET','<?php echo get_option('siteurl'); ?>/wp-cron.php?'+(new Date()).getTime(), true);x.send('');}},10);
     378/* ]]> */
     379</script>
     380<?php
     381}
     382
     383?>
Note: See TracChangeset for help on using the changeset viewer.