From d5f286f1aa543ed8d677fa5370bc4082c6d45692 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 18 May 2004 13:38:58 +0000 Subject: [PATCH] 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 --- admin/cron.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/cron.php b/admin/cron.php index 5a16fd5598..5f307ba63d 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -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"); -- 2.39.5