function system_post_update_delete_rss_config

Same name and namespace in other branches
  1. main core/modules/system/system.post_update.php \system_post_update_delete_rss_config()

Delete obsolete system.rss configuration.

File

core/modules/system/system.post_update.php, line 132

Code

function system_post_update_delete_rss_config(array &$sandbox) : void {
  if (!isset($sandbox['#system_post_update_delete_rss_config__previous_view_mode'])) {
    $sandbox['#system_post_update_delete_rss_config__previous_view_mode'] = \Drupal::configFactory()->getEditable('system.rss')
      ->get('items.view_mode');
  }
  if (\Drupal::moduleHandler()->moduleExists('views')) {
    /** @var \Drupal\views\ViewsConfigUpdater $view_config_updater */
    $view_config_updater = \Drupal::classResolver(ViewsConfigUpdater::class);
    $view_config_updater->setDeprecationsEnabled(FALSE);
    \Drupal::classResolver(ConfigEntityUpdater::class)->update($sandbox, 'view', function (ViewEntityInterface $view) use ($view_config_updater, $sandbox) : bool {
      return $view_config_updater->needsRssViewModeUpdate($view, $sandbox['#system_post_update_delete_rss_config__previous_view_mode']);
    });
  }
  if (!isset($sandbox['#finished']) || $sandbox['#finished'] >= 1) {
    \Drupal::configFactory()->getEditable('system.rss')
      ->delete();
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.