Skip to content

Commit

Permalink
Merged recent fixes to FULLME in stable
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Dec 12, 2004
1 parent 6b94a80 commit f9f4d99
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions admin/cron.php
Expand Up @@ -11,9 +11,12 @@
/// 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()
Expand Down
4 changes: 2 additions & 2 deletions lib/moodlelib.php
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
}
Expand Down
5 changes: 3 additions & 2 deletions lib/setup.php
Expand Up @@ -284,8 +284,9 @@ class object {};
$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);
Expand Down

0 comments on commit f9f4d99

Please sign in to comment.