You are here

function system_post_update_uninstall_stable in Drupal 9

Uninstall Stable if it is no longer needed.

This needs to run after system_post_update_uninstall_classy(). This will be the case since getAvailableUpdateFunctions() returns an alphabetically sorted list of post_update hooks to be run.

See also

Drupal\Core\Update\UpdateRegistry::getAvailableUpdateFunctions()

File

core/modules/system/system.post_update.php, line 139
Post update functions for System.

Code

function system_post_update_uninstall_stable() {

  /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
  $theme_installer = \Drupal::getContainer()
    ->get('theme_installer');
  try {
    $theme_installer
      ->uninstall([
      'stable',
    ]);
  } catch (\InvalidArgumentException|UnknownExtensionException $exception) {

    // Exception is thrown if Stable wasn't installed or if there are themes
    // depending on it.
  }
}