Move system logging settings from variables to config.
function system_update_8014() {
// Not using update_variables_to_config(), since the only value is
// 'error_level', which needs to be mapped to a new value.
$config = config('system.logging');
$error_level = db_query("SELECT value FROM {variable} WHERE name = 'error_level'")
->fetchField();
if ($error_level !== FALSE) {
$error_level = unserialize($error_level);
$map = array(
'0' => 'hide',
'1' => 'some',
'2' => 'all',
'3' => 'verbose',
);
// Update error_level value to a string identifier.
$config
->set('error_level', $map[$error_level]);
// Delete the migrated variable.
db_delete('variable')
->condition('name', 'error_level')
->execute();
}
else {
// Set error_level to the default value.
$config
->set('error_level', 'all');
}
$config
->save();
}