A fix from boman in bug 1421 that allows the script to be

run from anywhere on the command line in PHP > 4.3.0.

ie:

   php /some/dir/moodle/admin/php.php

   ... now works again
This commit is contained in:
moodler 2004-05-18 13:38:58 +00:00
parent ffdd209ad2
commit d5f286f1aa

View File

@ -14,6 +14,14 @@
$FULLME = "cron";
$starttime = microtime();
/// The current directory in PHP version 4.3.0 and above isn't necessarily the
/// directory of the script when run from the command line. The require_once()
/// would fail, so we'll have to chdir()
if (!isset($_SERVER['REMOTE_ADDR']) && isset($_SERVER['argv'][0])) {
chdir(dirname($_SERVER['argv'][0]));
}
require_once("../config.php");