Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
"MDL-16954, get rid of remote_addr notice on cli, set ip = 0.0.0.0 in…
… mdl_log table when accessed from cli, merged from 1.9"
  • Loading branch information
dongsheng committed Dec 11, 2008
1 parent bf14070 commit 94b8568
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/datalib.php
Expand Up @@ -1895,6 +1895,9 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user
}

$REMOTE_ADDR = getremoteaddr();
if (empty($REMOTE_ADDR)) {
$REMOTE_ADDR = '0.0.0.0';
}

$timenow = time();
$info = $info;
Expand Down
6 changes: 5 additions & 1 deletion lib/moodlelib.php
Expand Up @@ -7439,7 +7439,11 @@ function getremoteaddr() {
return cleanremoteaddr($_SERVER['HTTP_X_FORWARDED_FOR']);
}
}
return cleanremoteaddr($_SERVER['REMOTE_ADDR']);
if (!empty($_SERVER['REMOTE_ADDR'])) {
return cleanremoteaddr($_SERVER['REMOTE_ADDR']);
} else {
return null;
}
}

/**
Expand Down

0 comments on commit 94b8568

Please sign in to comment.