Commit 79fbc3d7 authored by catch's avatar catch
Browse files

Issue #3132426 by alexpott, dww, GuyPaddock, catch, VladimirAus: Notice:...

Issue #3132426 by alexpott, dww, GuyPaddock, catch, VladimirAus: Notice: Undefined index: title in Drupal\update\ProjectSecurityRequirement

(cherry picked from commit d7758d65)
parent 6abcb743
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -82,8 +82,14 @@ public function getProjects();
  /**
   * Processes a step in batch for fetching available update data.
   *
   * Before calling this method, call
   * UpdateManagerInterface::refreshUpdateData() to clear existing update data
   * and initiate re-fetching.
   *
   * @param array $context
   *   Reference to an array used for Batch API storage.
   *
   * @see \Drupal\update\UpdateManagerInterface::refreshUpdateData()
   */
  public function fetchDataBatch(&$context);

+5 −0
Original line number Diff line number Diff line
@@ -127,6 +127,11 @@ public function createFetchTask($project) {
   */
  public function fetchData() {
    $end = time() + $this->updateSettings->get('fetch.timeout');
    if ($this->fetchQueue->numberOfItems()) {
      // Delete any stored project data as that needs refreshing when
      // update_calculate_project_data() is called.
      $this->tempStore->delete('update_project_data');
    }
    while (time() < $end && ($item = $this->fetchQueue->claimItem())) {
      $this->processFetchTask($item->data);
      $this->fetchQueue->deleteItem($item);
+3 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
</project>
+37 −0
Original line number Diff line number Diff line
@@ -862,6 +862,43 @@ public function testRevokedRelease() {
    }
  }

  /**
   * Checks that Drupal recovers after problems connecting to update server.
   */
  public function testBrokenThenFixedUpdates() {
    $this->drupalLogin($this->drupalCreateUser([
      'administer site configuration',
      'access administration pages',
    ]));
    $this->setSystemInfo('8.0.0');
    // Instead of using refreshUpdateStatus(), set these manually.
    $this->config('update.settings')
      ->set('fetch.url', Url::fromRoute('update_test.update_test')->setAbsolute()->toString())
      ->save();
    // Use update XML that has no information to simulate a broken response from
    // the update server.
    $this->config('update_test.settings')
      ->set('xml_map', ['drupal' => 'broken'])
      ->save();

    // This will retrieve broken updates.
    $this->cronRun();
    $this->drupalGet('admin/reports/status');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains('There was a problem checking available updates for Drupal.');
    $this->config('update_test.settings')
      ->set('xml_map', ['drupal' => 'sec.0.2'])
      ->save();
    // Simulate the update_available_releases state expiring before cron is run
    // and the state is used by \Drupal\update\UpdateManager::getProjects().
    \Drupal::keyValueExpirable('update_available_releases')->deleteAll();
    // This cron run should retrieve fixed updates.
    $this->cronRun();
    $this->drupalGet('admin/structure');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains('There is a security update available for your version of Drupal.');
  }

  /**
   * Tests messages when a project release is marked unsupported.
   *