Merge branch 'master_MDL-38019' of git://github.com/andyjdavis/moodle
This commit is contained in:
+1
-9
@@ -1737,15 +1737,7 @@ abstract class admin_setting {
|
||||
rebuild_course_cache(0, true);
|
||||
}
|
||||
|
||||
// log change
|
||||
$log = new stdClass();
|
||||
$log->userid = during_initial_install() ? 0 :$USER->id; // 0 as user id during install
|
||||
$log->timemodified = time();
|
||||
$log->plugin = $this->plugin;
|
||||
$log->name = $name;
|
||||
$log->value = $value;
|
||||
$log->oldvalue = $oldvalue;
|
||||
$DB->insert_record('config_log', $log);
|
||||
add_to_config_log($name, $oldvalue, $value, $this->plugin);
|
||||
|
||||
return true; // BC only
|
||||
}
|
||||
|
||||
@@ -1538,6 +1538,35 @@ function coursemodule_visible_for_user($cm, $userid=0) {
|
||||
|
||||
/// LOG FUNCTIONS /////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
* Add an entry to the config log table.
|
||||
*
|
||||
* These are "action" focussed rather than web server hits,
|
||||
* and provide a way to easily reconstruct changes to Moodle configuration.
|
||||
*
|
||||
* @package core
|
||||
* @category log
|
||||
* @global moodle_database $DB
|
||||
* @global stdClass $USER
|
||||
* @param string $name The name of the configuration change action
|
||||
For example 'filter_active' when activating or deactivating a filter
|
||||
* @param string $oldvalue The config setting's previous value
|
||||
* @param string $value The config setting's new value
|
||||
* @param string $plugin Plugin name, for example a filter name when changing filter configuration
|
||||
* @return void
|
||||
*/
|
||||
function add_to_config_log($name, $oldvalue, $value, $plugin) {
|
||||
global $USER, $DB;
|
||||
|
||||
$log = new stdClass();
|
||||
$log->userid = during_initial_install() ? 0 :$USER->id; // 0 as user id during install
|
||||
$log->timemodified = time();
|
||||
$log->name = $name;
|
||||
$log->oldvalue = $oldvalue;
|
||||
$log->value = $value;
|
||||
$log->plugin = $plugin;
|
||||
$DB->insert_record('config_log', $log);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an entry to the log table.
|
||||
|
||||
@@ -571,17 +571,22 @@ function filter_set_global_state($filtername, $state, $move = 0) {
|
||||
if (isset($on[$filtername])) {
|
||||
$filter = $on[$filtername];
|
||||
if ($filter->active != $state) {
|
||||
add_to_config_log('filter_active', $filter->active, $state, $filtername);
|
||||
|
||||
$filter->active = $state;
|
||||
$DB->update_record('filter_active', $filter);
|
||||
if ($filter->active == TEXTFILTER_DISABLED) {
|
||||
unset($on[$filtername]);
|
||||
$off = array($filter->filter => $filter) + $off;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (isset($off[$filtername])) {
|
||||
$filter = $off[$filtername];
|
||||
if ($filter->active != $state) {
|
||||
add_to_config_log('filter_active', $filter->active, $state, $filtername);
|
||||
|
||||
$filter->active = $state;
|
||||
$DB->update_record('filter_active', $filter);
|
||||
if ($filter->active != TEXTFILTER_DISABLED) {
|
||||
@@ -591,6 +596,8 @@ function filter_set_global_state($filtername, $state, $move = 0) {
|
||||
}
|
||||
|
||||
} else {
|
||||
add_to_config_log('filter_active', '', $state, $filtername);
|
||||
|
||||
$filter = new stdClass();
|
||||
$filter->filter = $filtername;
|
||||
$filter->contextid = $syscontext->id;
|
||||
|
||||
Reference in New Issue
Block a user