]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-16954, use rebert\'s patch to clean notice/warning in cron job via php cli,...
authordongsheng <dongsheng>
Mon, 3 Nov 2008 05:25:30 +0000 (05:25 +0000)
committerdongsheng <dongsheng>
Mon, 3 Nov 2008 05:25:30 +0000 (05:25 +0000)
lib/moodlelib.php

index f3af61186b1967efc529a011a300a70d43e49e5d..2c2f49f7f31bf68ea8e87bb22a18574a0d8e886d 100644 (file)
@@ -3357,8 +3357,10 @@ function get_complete_user_data($field, $value, $mnethostid=null) {
         $user->lastname   = ' ';
     }
 
-    $user->sesskey  = random_string(10);
-    $user->sessionIP = md5(getremoteaddr());   // Store the current IP in the session
+    if (isset($_SERVER['REMOTE_ADDR'])) {
+        $user->sesskey  = random_string(10);
+        $user->sessionIP = md5(getremoteaddr());   // Store the current IP in the session
+    }
 
     return $user;
 }