This is a very useful little trick for users who need to setup a cron job for process queue and/or process bounces where they also need to create various admins for the mailing lists (i.e. they need login to work). In no way can I take any of the credit for this - that belongs to Jeff (yookoso), who devised this ingenious bit of hacking.
Many users who have attempted cron jobs with $require_login = 1; (in config.php), have no doubt been frustrated by the cron returning a lengthy HTML code that informs you of the need to login.
So Jeff's come up with the following solution:
In admin/index.php, find the following:
error_reporting($er);
Immediately after that, insert the following:
// -------------------------------------------------
if ($var) {
$temp = explode("-", $var);
$page = $temp[0];
$_GET["page"] = $temp[0];
$cli = $temp[1];
if ($cli) $GLOBALS["require_login"] = 0;
}
// -------------------------------------------------
Then write your cron to resemble the following:
10 * * * * GET http://yourdomain.com/phpList/admin/?va ... squeue-cli > /dev/null
or
10 * * * * GET http://yourdomain.com/phpList/admin/?va ... ounces-cli > /dev/null
10 * * * *, of course, being the timing of the cron job however you want it, and http://yourdomain.com/phpList/ should be customised to your own site.
If the bit of PHP above seems a little strange, Jeff originally wrote that to get his cron job to work using lynx (he doesn't have GET installed on his system), while at the same time getting around the login issue. All I did was to realise that the same method could work with GET.
In Jeff's case, the cron command would be as follows:
10 * * * * lynx -dump http://yourdomain.com/phpList/admin/?va ... squeue-cli > /dev/null
or
10 * * * * lynx -dump http://yourdomain.com/phpList/admin/?va ... ounces-cli > /dev/null
That's it, in a nutshell. For more explanation on Jeff's method, you can view his original posting at http://www.phplist.com/forums/viewtopic.php?t=1074
Phil
