function UpdateManager::getProjects

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

File

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

Class

UpdateManager
Default implementation of UpdateManagerInterface.

Namespace

Drupal\update

Code

public function getProjects() {
    if (empty($this->projects)) {
        // Retrieve the projects from storage, if present.
        $this->projects = $this->projectStorage('update_project_projects');
        if (empty($this->projects)) {
            // Still empty, so we have to rebuild.
            $module_data = $this->moduleExtensionList
                ->reset()
                ->getList();
            $theme_data = $this->themeExtensionList
                ->reset()
                ->getList();
            $project_info = new ProjectInfo();
            $project_info->processInfoList($this->projects, $module_data, 'module', TRUE);
            $project_info->processInfoList($this->projects, $theme_data, 'theme', TRUE);
            if ($this->updateSettings
                ->get('check.disabled_extensions')) {
                $project_info->processInfoList($this->projects, $module_data, 'module', FALSE);
                $project_info->processInfoList($this->projects, $theme_data, 'theme', FALSE);
            }
            // Allow other modules to alter projects before fetching and comparing.
            $this->moduleHandler
                ->alter('update_projects', $this->projects);
            // Store the site's project data for at most 1 hour.
            $this->keyValueStore
                ->setWithExpire('update_project_projects', $this->projects, 3600);
        }
    }
    return $this->projects;
}

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