Commit d7758d65 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
parent 79f9e9dc
......@@ -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);
......
......@@ -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);
......
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:dc="http://purl.org/dc/elements/1.1/">
</project>
......@@ -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.
*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment