0)
{
// for each blog in the system
foreach ($blogs as $blog)
{
$cronStartTime = microtime(true);
echo date('Y/m/d H:i:s', $cronStartTime) . " Starting wp-cron for $blog->domain"."$blog->path...";
$cron_url = $blog->domain . $blog->path . 'wp-cron.php?doing_wp_cron';
// perform the call to wp-cron.php
// wp_remote_post parameters values were taken from the original call in wordpress
// (see spawn_cron() function declaration)
wp_remote_post( $cron_url, array('timeout' => 0.01, 'blocking' => false, 'sslverify' => false) );
$cronEndTime = microtime(true);
$duration = $cronEndTime - $cronStartTime;
echo " (completed in ". $duration ." seconds)
\r\n";
}
}
$endTime = microtime(true);
$duration = $endTime - $startTime;
echo "
\r\nAll tasks completed in ". $duration ." seconds
\r\n";
// ***********************************************************************
// Function declarations
// ***********************************************************************
function crontab_get_blogs()
{
global $wpdb;
$sql = "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE public = 1 AND deleted = 0 AND archived = '0' ORDER BY domain, path";
$result = $wpdb->get_results($sql);
return ($result);
}
?>