]> git.mjollnir.org Git - moodle.git/commitdiff
Merged recent fixes to FULLME in stable
authormoodler <moodler>
Sun, 12 Dec 2004 06:49:26 +0000 (06:49 +0000)
committermoodler <moodler>
Sun, 12 Dec 2004 06:49:26 +0000 (06:49 +0000)
admin/cron.php
lib/moodlelib.php
lib/setup.php

index bf078167e733597b5e4bbc4cd54f0d00efd54883..6d7608f6ed3c27bbaa76cd0d8842d213bc60eda6 100644 (file)
 /// eg   wget -q -O /dev/null 'http://moodle.somewhere.edu/admin/cron.php'
 /// or   php /web/moodle/admin/cron.php 
 
-    $FULLME = "cron";
-
     $starttime = microtime();
+
+/// The following is a hack necessary to allow this script to work well 
+/// from the command line.
+
+    define('FULLME', 'cron');
     
 /// 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()
index b526bd09306d2664979efe3d59deba4bb37183c4..873fe86fc86645f62afed9827bc7d5b9827b167b 100644 (file)
@@ -2279,7 +2279,7 @@ function setup_and_print_groups($course, $groupmode, $urlroot) {
  */
 function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $attachment='', $attachname='', $usetrueaddress=true) {
 
-    global $CFG, $_SERVER;
+    global $CFG, $FULLME;
 
     global $course;                // This is a bit of an ugly hack to be gotten rid of later
     if (!empty($course->lang)) {   // Course language is defined
@@ -2382,7 +2382,7 @@ function email_to_user($user, $from, $subject, $messagetext, $messagehtml='', $a
         return true;
     } else {
         mtrace('ERROR: '. $mail->ErrorInfo);
-        add_to_log(SITEID, 'library', 'mailer', $_SERVER['REQUEST_URI'], 'ERROR: '. $mail->ErrorInfo);
+        add_to_log(SITEID, 'library', 'mailer', $FULLME, 'ERROR: '. $mail->ErrorInfo);
         return false;
     }
 }
index f5cd653f1a5aec98f93b81b383d0ec34340d46d4..0de4c1717b98bafce9410f409ad9b7651427023f 100644 (file)
@@ -284,8 +284,9 @@ global $THEME;
         $USER    = &$_SESSION['USER'];
     }
 
-    if (isset($FULLME)) {
-        $ME = $FULLME;
+    if (defined('FULLME')) {     // Usually in command-line scripts like admin/cron.php
+        $FULLME = FULLME;
+        $ME = FULLME;
     } else {
         $FULLME = qualified_me();
         $ME = strip_querystring($FULLME);