You are here

public function UpdateManager::projectStorage in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/update/src/UpdateManager.php \Drupal\update\UpdateManager::projectStorage()
  2. 9 core/modules/update/src/UpdateManager.php \Drupal\update\UpdateManager::projectStorage()

File

core/modules/update/src/UpdateManager.php, line 164

Class

UpdateManager
Default implementation of UpdateManagerInterface.

Namespace

Drupal\update

Code

public function projectStorage($key) {
  $projects = [];

  // On certain paths, we should clear the data and recompute the projects for
  // update status of the site to avoid presenting stale information.
  $route_names = [
    'update.theme_update',
    'system.modules_list',
    'system.theme_install',
    'update.module_update',
    'update.module_install',
    'update.status',
    'update.report_update',
    'update.report_install',
    'update.settings',
    'system.status',
    'update.manual_status',
    'update.confirmation_page',
    'system.themes_page',
  ];
  if (in_array(\Drupal::routeMatch()
    ->getRouteName(), $route_names)) {
    $this->keyValueStore
      ->delete($key);
  }
  else {
    $projects = $this->keyValueStore
      ->get($key, []);
  }
  return $projects;
}