diff --git a/modules/search_api_views_taxonomy/search_api_views_taxonomy.install b/modules/search_api_views_taxonomy/search_api_views_taxonomy.install index 034a1728..86e46b8b 100644 --- a/modules/search_api_views_taxonomy/search_api_views_taxonomy.install +++ b/modules/search_api_views_taxonomy/search_api_views_taxonomy.install @@ -6,6 +6,7 @@ */ use Drupal\Core\Url; +use Drupal\Core\Utility\UpdateException; use Drupal\views\Entity\View; /** @@ -30,11 +31,18 @@ function search_api_views_taxonomy_requirements($phase) { } /** - * Re-save all views to remove dependencies on this module. + * Re-save all views with dependencies on this module to remove the dependency. */ function search_api_views_taxonomy_update_8001() { /** @var \Drupal\views\Entity\View $view */ foreach (View::loadMultiple() as $view) { + $dependencies = $view->getDependencies(); + if (!isset($dependencies['module'])) { + continue; + } + if (!in_array('search_api_views_taxonomy', $dependencies['modue'], TRUE)) { + continue; + } $view->save(); } } @@ -46,8 +54,8 @@ function search_api_views_taxonomy_update_8002() { /** @var \Drupal\Core\Extension\ModuleInstaller $module_installer */ $module_installer = \Drupal::service('module_installer'); if ($module_installer->validateUninstall(['search_api_views_taxonomy']) !== []) { - \Drupal::messenger()->addError('search_api_views_taxonomy has become obsolete and will be removed in a future release of search_api, but we are unable to automatically uninstall it for you. Please manually uninstall the module.'); - return; + $message = 'search_api_views_taxonomy has become obsolete and will be removed in a future release of search_api, but we are unable to automatically uninstall it for you. Please manually uninstall the module.'; + throw new UpdateException($message); } $module_installer->uninstall(['search_api_views_taxonomy']);