MDL-25152 guest logging can be disabled now
authorPetr Skoda <skodak@moodle.org>
Thu, 11 Nov 2010 06:11:13 +0000 (06:11 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 11 Nov 2010 06:11:13 +0000 (06:11 +0000)
admin/settings/server.php
lang/en/admin.php
lib/datalib.php
version.php

index 4b52291..aed8304 100644 (file)
@@ -185,6 +185,8 @@ $temp->add(new admin_setting_configselect('deleteincompleteusers', get_string('d
                                                                                                                                                                     48 => get_string('numdays', '', 2),
                                                                                                                                                                     24 => get_string('numdays', '', 1))));
 
+$temp->add(new admin_setting_configcheckbox('logguests', get_string('logguests', 'admin'),
+                                            get_string('logguests_help', 'admin'), 1));
 $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime', 'admin'), get_string('configloglifetime', 'admin'), 0, array(0 => get_string('neverdeletelogs'),
                                                                                                                                                 1000 => get_string('numdays', '', 1000),
                                                                                                                                                 365 => get_string('numdays', '', 365),
@@ -200,7 +202,7 @@ $temp->add(new admin_setting_configselect('loglifetime', get_string('loglifetime
 
 
 $temp->add(new admin_setting_configcheckbox('disablegradehistory', get_string('disablegradehistory', 'grades'),
-                                            get_string('disablegradehistory_help', 'grades'), 0, PARAM_INT));
+                                            get_string('disablegradehistory_help', 'grades'), 0));
 
 $temp->add(new admin_setting_configselect('gradehistorylifetime', get_string('gradehistorylifetime', 'grades'),
                                           get_string('gradehistorylifetime_help', 'grades'), 0, array(0 => get_string('neverdeletehistory', 'grades'),
index e50311f..4004517 100755 (executable)
@@ -658,6 +658,8 @@ $string['location'] = 'Location';
 $string['locationsettings'] = 'Location settings';
 $string['locked'] = 'locked';
 $string['log'] = 'Logs';
+$string['logguests'] = 'Log guest access';
+$string['logguests_help'] = 'This setting enables logging of actions by guest account and not logged in users. High profile sites may want to disable this logging for performance reasons. It is recommended to keep this setting enabled on production sites.';
 $string['loginhttps'] = 'Use HTTPS for logins';
 $string['loglifetime'] = 'Keep logs for';
 $string['longtimewarning'] = '<b>Please note that this process can take a long time.</b>';
index 19fed2b..05b4254 100644 (file)
@@ -1645,6 +1645,12 @@ function add_to_log($courseid, $module, $action, $url='', $info='', $cm=0, $user
         $userid = empty($USER->id) ? '0' : $USER->id;
     }
 
+    if (isset($CFG->logguests) and !$CFG->logguests) {
+        if (!$userid or isguestuser($userid)) {
+            return;
+        }
+    }
+
     $REMOTE_ADDR = getremoteaddr();
 
     $timenow = time();
index 1f4baab..bee5276 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version = 2010111000;  // YYYYMMDD   = date of the last version bump
+$version = 2010111001;  // YYYYMMDD   = date of the last version bump
                         //         XX = daily increments
 
 $release = '2.0 RC1 (Build: 20101111)';  // Human-friendly version name