Issue #3239191 by paul121: Change farm_update to ignore simple config
This commit is contained in:
parent
fa3ead44a1
commit
3a46ccb60b
12
farm.profile
12
farm.profile
|
@ -71,15 +71,3 @@ function farm_form_update_manager_update_form_alter(&$form, &$form_state, $form_
|
|||
\Drupal::messenger()->addError($message);
|
||||
$form['actions']['#access'] = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_update_exclude_config().
|
||||
*/
|
||||
function farm_farm_update_exclude_config() {
|
||||
|
||||
// Exclude config that we have overridden in hook_install().
|
||||
return [
|
||||
'system.file',
|
||||
'user.settings',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -105,16 +105,3 @@ function farm_api_entity_base_field_info(EntityTypeInterface $entity_type) {
|
|||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_update_exclude_config().
|
||||
*/
|
||||
function farm_api_farm_update_exclude_config() {
|
||||
|
||||
// Exclude config that we have overridden in hook_install().
|
||||
return [
|
||||
'jsonapi.settings',
|
||||
'jsonapi_extras.settings',
|
||||
'simple_oauth.settings',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -176,14 +176,3 @@ function farm_entity_form_alter(&$form, FormStateInterface $form_state, $form_id
|
|||
// Disable access to the revision checkbox.
|
||||
$form['revision']['#access'] = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_update_exclude_config().
|
||||
*/
|
||||
function farm_entity_farm_update_exclude_config() {
|
||||
|
||||
// Exclude config that we have overridden in hook_install().
|
||||
return [
|
||||
'entity_reference_integrity_enforce.settings',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -215,14 +215,3 @@ function template_preprocess_quantity(array &$variables) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_update_exclude_config().
|
||||
*/
|
||||
function quantity_farm_update_exclude_config() {
|
||||
|
||||
// Exclude quantity.settings config from automatic updates.
|
||||
return [
|
||||
'quantity.settings',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -31,14 +31,3 @@ function farm_ui_location_help($route_name, RouteMatchInterface $route_match) {
|
|||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_farm_update_exclude_config().
|
||||
*/
|
||||
function farm_ui_location_farm_update_exclude_config() {
|
||||
|
||||
// Exclude config that we have overridden in hook_install().
|
||||
return [
|
||||
'inspire_tree.settings',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -186,7 +186,5 @@ function farm_ui_theme_farm_update_exclude_config() {
|
|||
// Exclude config that we have overridden in hook_install().
|
||||
return [
|
||||
'block.block.gin_local_actions',
|
||||
'gin.settings',
|
||||
'system.theme',
|
||||
];
|
||||
}
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
*/
|
||||
function hook_farm_update_exclude_config() {
|
||||
return [
|
||||
'core.extension',
|
||||
'system.date',
|
||||
'views.view.farm_log.yml',
|
||||
'asset.type.structure.yml',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -19,11 +19,6 @@ function farm_update_farm_update_exclude_config() {
|
|||
|
||||
// Exclude Drupal core configurations from automatic updates.
|
||||
return [
|
||||
'core.extension',
|
||||
'system.date',
|
||||
'system.performance',
|
||||
'system.site',
|
||||
'update.settings',
|
||||
'user.role.anonymous',
|
||||
'user.role.authenticated',
|
||||
];
|
||||
|
|
|
@ -98,12 +98,11 @@ class FarmUpdate implements FarmUpdateInterface {
|
|||
// Iterate through config items and revert them.
|
||||
foreach ($revert_config as $name) {
|
||||
|
||||
// Get the config type.
|
||||
// The lister gives NULL if simple configuration, but the reverter
|
||||
// expects 'system.simple' so we convert it.
|
||||
// Get the config type and bail if simple configuration.
|
||||
// The lister gives NULL if simple configuration.
|
||||
$type = $this->configList->getTypeNameByConfigName($name);
|
||||
if ($type === NULL) {
|
||||
$type = 'system.simple';
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get the config short name.
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
exclude_config:
|
||||
- system.theme
|
||||
- farm_flag.flag.review
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
* Implements hook_farm_update_exclude_config().
|
||||
*/
|
||||
function farm_update_test_farm_update_exclude_config() {
|
||||
return ['system.file'];
|
||||
return ['farm_flag.flag.priority'];
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class FarmUpdateTest extends KernelTestBase {
|
|||
'config_update',
|
||||
'farm_update',
|
||||
'farm_update_test',
|
||||
'system',
|
||||
'farm_flag',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -42,9 +42,10 @@ class FarmUpdateTest extends KernelTestBase {
|
|||
parent::setUp();
|
||||
$this->configFactory = \Drupal::service('config.factory');
|
||||
$this->farmUpdate = \Drupal::service('farm.update');
|
||||
$this->installEntitySchema('flag');
|
||||
$this->installConfig([
|
||||
'farm_update_test',
|
||||
'system',
|
||||
'farm_flag',
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -54,15 +55,15 @@ class FarmUpdateTest extends KernelTestBase {
|
|||
public function testFarmUpdate() {
|
||||
|
||||
// Confirm that overridden config gets reverted.
|
||||
$this->farmUpdateTestRevertSetting('system.logging', 'error_level', 'all');
|
||||
$this->farmUpdateTestRevertSetting('farm_flag.flag.monitor', 'label', 'Changed');
|
||||
|
||||
// Confirm that config excluded via hook_farm_update_exclude_config() does
|
||||
// not get reverted.
|
||||
$this->farmUpdateTestRevertSetting('system.file', 'default_scheme', 'public', TRUE);
|
||||
$this->farmUpdateTestRevertSetting('farm_flag.flag.priority', 'label', 'Changed', TRUE);
|
||||
|
||||
// Confirm that config excluded via farm_update.settings does not get
|
||||
// reverted.
|
||||
$this->farmUpdateTestRevertSetting('system.theme', 'default', 'claro', TRUE);
|
||||
$this->farmUpdateTestRevertSetting('farm_flag.flag.review', 'label', 'Changed', TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue