diff --git a/admin/cli/cfg.php b/admin/cli/cfg.php index 7f56b926cb9..35045ca96f1 100644 --- a/admin/cli/cfg.php +++ b/admin/cli/cfg.php @@ -124,7 +124,12 @@ if ($options['unset'] || $options['set'] !== null) { cli_error('The configuration variable is hard-set in the config.php, unable to change.', 4); } - set_config($options['name'], $options['set'], $options['component']); + $new = $options['set']; + $old = get_config($options['component'], $options['name']); + if ($new !== $old) { + set_config($options['name'], $options['set'], $options['component']); + add_to_config_log($options['name'], $old, $new, $options['component']); + } exit(0); } diff --git a/report/configlog/classes/output/report_table.php b/report/configlog/classes/output/report_table.php index 5927f782ec7..3909387c3ff 100644 --- a/report/configlog/classes/output/report_table.php +++ b/report/configlog/classes/output/report_table.php @@ -90,7 +90,7 @@ class report_table extends \table_sql implements \renderable { $fields = 'cl.id, cl.timemodified, cl.plugin, cl.name, cl.value, cl.oldvalue, cl.userid, ' . $userfields; $from = '{config_log} cl - JOIN {user} u ON u.id = cl.userid'; + LEFT JOIN {user} u ON u.id = cl.userid'; // Report search. $where = '1=1'; @@ -143,6 +143,24 @@ class report_table extends \table_sql implements \renderable { return userdate($row->timemodified); } + /** + * Format fullname field + * + * @param stdClass $row + * @return string + */ + public function col_fullname($row) { + + $userid = $row->{$this->useridfield}; + if (empty($userid)) { + // If the user id is empty it must have been set via the + // admin/cli/cfg.php script or during the initial install. + return get_string('usernone', 'report_configlog'); + } else { + return parent::col_fullname($row); + } + } + /** * Format report plugin field * diff --git a/report/configlog/lang/en/report_configlog.php b/report/configlog/lang/en/report_configlog.php index 40645fd4c18..643c7b6d103 100644 --- a/report/configlog/lang/en/report_configlog.php +++ b/report/configlog/lang/en/report_configlog.php @@ -31,6 +31,7 @@ $string['pluginname'] = 'Config changes'; $string['setting'] = 'Setting'; $string['timemodified'] = 'Date'; $string['user'] = 'User'; +$string['usernone'] = 'CLI or install'; $string['user_help'] = 'Search by user first name or surname'; $string['value'] = 'Value'; $string['value_help'] = 'Search by new or original value of the configuration';