Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 8 years ago

#9118 closed enhancement (duplicate)

cron loopback fix

Reported by: cookeal's profile cookeal Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: cron loopback
Focuses: Cc:

Description

I was one of the people on shared hosting behind a firewall that did not allow loopbacks and therefore could not get any of the cron tasks to work. After a long and cooperative discussion with my hosts they have provided an amended cron.php and wp-cron.php to circumvent the problem - they have not changed their firewall but after applying the amended files to 5/6 of my blogs I can confirm full cron functionality. I am not a programmer and therefore dont really understand the mechanics of the fix, but wonder whether this fix should be posted here in order that it can be incorporated into the build and therefore solve this problem for others. Would be happy if someone could advise whether or not I am in the right place and how to proceed?
Many thanks

Change History (4)

#1 @sivel
14 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

duplicate of #9005

Please see the discussion in #9005 for improvements that will be included in 2.8.

#2 @filosofo
14 years ago

cookeal, I'd appreciate being able to see what they came up with, so could you attach the code here?

#3 @cookeal
14 years ago

Sure, will try:

In cron.php this:

	wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' => false));
}

has been replaced with:

	//wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' => false));
	$i = 0;
	$pre_exec = "";
	if (file_exists("wp-cron.php"))
		$pre_exec = "";
	else if (file_exists("../wp-cron.php"))
		$pre_exec = "cd ..; ";
	else {  
		error_log("Couldn't find wp-cron.php");
	return;
	}
	system("$pre_exec /usr/bin/php5-cli wp-cron.php >/dev/null 2>&1 </dev/null &", $i);
	// Added by one-click installable to work around block on HTTP callbacks on 
    // servers that firewall block calls to themselves.
}

And in wp-cron.php this:

if ( $_GET['check'] != wp_hash('187425') )
	exit;

has changed to this:

//if ( $_GET['check'] != wp_hash('187425') )
//	exit;

As I said above this seems to have resolved all my issues, but I dont pretend to understand why!

#4 @DrewAPicture
8 years ago

  • Milestone 2.7.2 deleted
Note: See TracTickets for help on using tickets.