mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
MDL-68261 report_configlog: Log changes from admin/cli/cfg.php
This commit is contained in:
parent
cd391f9922
commit
76de190c25
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
|
@ -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';
|
||||
|
Loading…
x
Reference in New Issue
Block a user