1 dblog.install | dblog_update_1003() |
Restore the format for dates in the database log.
File
- core/
modules/ dblog/ dblog.install, line 121 - Install, update and uninstall functions for the dblog module.
Code
function dblog_update_1003() {
// The "log_date_format" value may be a pattern or a named format.
$core_config = config('system.core');
$log_format = $core_config->get('log_date_format');
$date_format_config = config('system.date');
$date_formats = $date_format_config->get('formats');
// If a named pattern is in use, store its pattern directly.
if (isset($date_formats[$log_format])) {
$core_config->set('log_date_format', $date_formats[$log_format]['pattern']);
$core_config->save();
}
// Remove the previously created named format for logging.
if (isset($date_formats['dblog_date_format'])) {
unset($date_formats['dblog_date_format']);
$date_format_config->set('formats', $date_formats);
$date_format_config->save();
}
}