function UpdateManager::projectStorage

Same name and namespace in other branches
  1. 9 core/modules/update/src/UpdateManager.php \Drupal\update\UpdateManager::projectStorage()
  2. 8.9.x core/modules/update/src/UpdateManager.php \Drupal\update\UpdateManager::projectStorage()
  3. 10 core/modules/update/src/UpdateManager.php \Drupal\update\UpdateManager::projectStorage()
1 call to UpdateManager::projectStorage()
UpdateManager::getProjects in core/modules/update/src/UpdateManager.php

File

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

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;
}

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