ProjectInfo example


  protected function getMatchingExtensionInfo(SecurityAdvisory $sa): ?array {
    if (!isset($this->extensionLists[$sa->getProjectType()])) {
      return NULL;
    }
    $project_info = new ProjectInfo();
    // The project name on the security advisory will not always match the     // machine name for the extension, so we need to search through all     // extensions of the expected type to find the matching project.     foreach ($this->extensionLists[$sa->getProjectType()]->getList() as $extension) {
      if ($project_info->getProjectName($extension) === $sa->getProject()) {
        return $extension->info;
      }
    }
    return NULL;
  }

  
/** * {@inheritdoc} */
  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->themeHandler->rebuildThemeData();
        $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);
      }
    }
'hidden' => TRUE,
      ],
      // Show the update_test_subtheme.       'update_test_subtheme' => [
        'project' => 'update_test_subtheme',
        'hidden' => FALSE,
      ],
    ];
    $this->config('update_test.settings')->set('system_info', $system_info)->save();
    $projects = \Drupal::service('update.manager')->getProjects();
    $theme_data = \Drupal::service('theme_handler')->rebuildThemeData();
    $project_info = new ProjectInfo();
    $project_info->processInfoList($projects$theme_data, 'theme', TRUE);

    $this->assertNotEmpty($projects['update_test_basetheme'], 'Valid base theme (update_test_basetheme) was found.');
  }

  /** * Makes sure that if we fetch from a broken URL, sane things happen. */
  public function testUpdateBrokenFetchURL() {
    $system_info = [
      '#all' => [
        
Home | Imprint | This part of the site doesn't use cookies.