mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Apache log integration -- updated with more options to control what is logged as username. Implemented by Patrick Li.
This commit is contained in:
parent
2fa17f9c41
commit
5c5c16bb98
@ -248,6 +248,14 @@ $CFG->admin = 'admin';
|
||||
// entry in apache error log indicating the position of the error and the statement
|
||||
// called. This option will action disregarding error_reporting setting.
|
||||
// $CFG->dblogerror = true;
|
||||
//
|
||||
// The following setting will turn on username logging into Apache log. For full details regarding setting
|
||||
// up of this function please refer to the install section of the document.
|
||||
// $CFG->apacheloguser = 0; // Turn this feature off. Default value.
|
||||
// $CFG->apacheloguser = 1; // Log user id.
|
||||
// $CFG->apacheloguser = 2; // Log full name in cleaned format. ie, Darth Vader will be displayed as darth_vader.
|
||||
// $CFG->apacheloguser = 3; // Log username. CAUTION: Use of this value will expose usernames in the Apache log,
|
||||
// If you are going to publish your log in any cases, this will be a BIG security problem.
|
||||
|
||||
//=========================================================================
|
||||
// ALL DONE! To continue installation, visit your main page with a browser
|
||||
|
@ -411,8 +411,20 @@ global $THEME;
|
||||
|
||||
/// Apache log intergration. In apache conf file one can use ${MOODULEUSER}n in
|
||||
/// LogFormat to get the current logged in username in moodle.
|
||||
if ($USER && function_exists('apache_note')) {
|
||||
apache_note('MOODLEUSER', $USER->username);
|
||||
if ($USER && function_exists('apache_note') && !empty($CFG->apacheloguser)) {
|
||||
switch ($CFG->apacheloguser) {
|
||||
case 3:
|
||||
$logname = clean_filename($USER->username);
|
||||
break;
|
||||
case 2:
|
||||
$logname = clean_filename($USER->firstname." ".$USER->lastname);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
$logname = $USER->id;
|
||||
break;
|
||||
}
|
||||
apache_note('MOODLEUSER', $logname);
|
||||
}
|
||||
|
||||
/***
|
||||
|
Loading…
x
Reference in New Issue
Block a user