From 6af6126206dba3034e6b814b1b11c86ae42a7ca4 Mon Sep 17 00:00:00 2001 From: darthsteven <darthsteven@99644.no-reply.drupal.org> Date: Thu, 23 Aug 2018 16:00:25 +0100 Subject: [PATCH] Issue #2994644 by Steven Jones: Previously shipped (invalid) config will reappear --- imageapi_optimize.install | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/imageapi_optimize.install b/imageapi_optimize.install index e6bdc3e..dc1456a 100644 --- a/imageapi_optimize.install +++ b/imageapi_optimize.install @@ -6,9 +6,29 @@ */ /** - * Update misnamed config entites. + * Remove previously invalid config entities. */ function imageapi_optimize_update_8001() { + $config_factory = \Drupal::configFactory(); + // These were mis-named, so can never have been in-use by anyone. + $legacy_pipelines = [ + 'imageapi_optimize.pipeline.resmushit', + 'imageapi_optimize.pipeline.local_binaries', + ]; + foreach ($legacy_pipelines as $legacy_pipeline) { + $config_list = $config_factory->listAll($legacy_pipeline); + foreach ($config_list as $config_key) { + $config = $config_factory->getEditable($config_key); + // Remove the old config entity. + $config->delete(); + } + } +} + +/** + * Update misnamed config entites. + */ +function imageapi_optimize_update_8002() { $config_factory = \Drupal::configFactory(); $config_list = $config_factory->listAll('imageapi_optimize.processor.'); @@ -34,7 +54,7 @@ function imageapi_optimize_update_8001() { /** * Re-enable sub modules. */ -function imageapi_optimize_update_8002() { +function imageapi_optimize_update_8003() { $modules = []; $pipelines = \Drupal\imageapi_optimize\Entity\ImageAPIOptimizePipeline::loadMultiple(); -- GitLab