From a559eee64e235923384aea4e02c0bcb6d817bbe9 Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Mon, 16 May 2005 02:51:05 +0000 Subject: [PATCH] Apache log intergration. In apache conf file one can use ${MOODULEUSER}n in LogFormat to get the current logged in username in moodle. Implemented by Patrick Li. --- lang/en/docs/install.html | 9 +++++++++ lib/setup.php | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/lang/en/docs/install.html b/lang/en/docs/install.html index 2812e7cfcdb..0fe6922bfda 100644 --- a/lang/en/docs/install.html +++ b/lang/en/docs/install.html @@ -209,6 +209,15 @@ php_value post_max_size 2M
cp lib/htaccess .htaccess
+
+

(Optional) To include the username of the current user in the Apache access log, add the following into your httpd.conf:

+
+
+LogFormat "%h %l %{MOODLEUSER}n %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" moodle
+CustomLog "/your/path/to/log" moodle
+
+

And then replace the "/your/path/to/log" to your http access log or to a new one. If your Moodle copy runs in a virtual host, add the lines in the corresponding block. Please refer to the Apache documentation for more information.

+

 

4.2 Creating a database

diff --git a/lib/setup.php b/lib/setup.php index 7d07e2bdf74..af2a774c531 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -409,6 +409,12 @@ 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); + } + /*** *** init_performance_info() { ***