diff --git a/src/Controller/ReadinessCheckerController.php b/src/Controller/ReadinessCheckerController.php index 869c6b25e844a19fd55223c4af93746525a6a62e..d49d0d4af8f70c064ed1e0bd1c7151a814188d9f 100644 --- a/src/Controller/ReadinessCheckerController.php +++ b/src/Controller/ReadinessCheckerController.php @@ -55,7 +55,7 @@ class ReadinessCheckerController extends ControllerBase { } $messages = array_merge(...$messages); if (empty($messages)) { - $this->messenger()->addStatus($this->t('No issues found. Your site is completely ready for <a href="@readiness_checks">automatic updates</a>.', ['@readiness_checks' => 'https://www.drupal.org/docs/8/update/automatic-updates#readiness-checks'])); + $this->messenger()->addStatus($this->t('No issues found. Your site is ready for <a href="@readiness_checks">automatic updates</a>.', ['@readiness_checks' => 'https://www.drupal.org/docs/8/update/automatic-updates#readiness-checks'])); } return $this->redirect('automatic_updates.settings'); } diff --git a/src/Services/InPlaceUpdate.php b/src/Services/InPlaceUpdate.php index 3bb44a114a6dbce3962c6e822cb821a1303604cd..c226d6fd60c89e3e54b302e94803a55510fafac1 100644 --- a/src/Services/InPlaceUpdate.php +++ b/src/Services/InPlaceUpdate.php @@ -220,7 +220,7 @@ class InPlaceUpdate implements UpdateInterface { /** @var \Drupal\automatic_updates\Services\ModifiedFilesInterface $modified_files */ $modified_files = \Drupal::service('automatic_updates.modified_files'); try { - $files = iterator_to_array($modified_files->getModifiedFiles([$extensions[$project_name]], TRUE)); + $files = iterator_to_array($modified_files->getModifiedFiles([$extensions[$project_name]])); } catch (RequestException $exception) { // While not strictly true that there are modified files, we can't be sure diff --git a/src/Services/ModifiedFiles.php b/src/Services/ModifiedFiles.php index 0b4473d680d54bd00a1987a243912d5638e1fd5c..c8171696c9ce16f9a98ff224a1bd8606a745a741 100644 --- a/src/Services/ModifiedFiles.php +++ b/src/Services/ModifiedFiles.php @@ -5,6 +5,7 @@ namespace Drupal\automatic_updates\Services; use Drupal\automatic_updates\IgnoredPathsTrait; use Drupal\automatic_updates\ProjectInfoTrait; use Drupal\Core\Config\ConfigFactoryInterface; +use Drupal\Core\Logger\RfcLogLevel; use Drupal\Core\Url; use Drupal\Signify\ChecksumList; use Drupal\Signify\FailedCheckumFilter; @@ -64,7 +65,7 @@ class ModifiedFiles implements ModifiedFilesInterface { /** * {@inheritdoc} */ - public function getModifiedFiles(array $extensions = [], $exception_on_failure = FALSE) { + public function getModifiedFiles(array $extensions = []) { $modified_files = new \ArrayIterator(); /** @var \GuzzleHttp\Promise\PromiseInterface[] $promises */ $promises = $this->getHashRequests($extensions); @@ -74,8 +75,8 @@ class ModifiedFiles implements ModifiedFilesInterface { 'fulfilled' => function (array $resource) use ($modified_files) { $this->processHashes($resource, $modified_files); }, - 'rejected' => function (RequestException $exception) use ($exception_on_failure) { - $this->processFailures($exception, $exception_on_failure); + 'rejected' => function (RequestException $exception) { + $this->processFailures($exception); }, ]))->promise()->wait(); return $modified_files; @@ -124,12 +125,13 @@ class ModifiedFiles implements ModifiedFilesInterface { * * @param \GuzzleHttp\Exception\RequestException $exception * The request exception. - * @param bool $exception_on_failure - * Throw exception on HTTP failures, defaults to FALSE. */ - protected function processFailures(RequestException $exception, $exception_on_failure) { - if ($exception_on_failure) { - watchdog_exception('automatic_updates', $exception); + protected function processFailures(RequestException $exception) { + // Log all the exceptions, even modules that aren't the main project. + watchdog_exception('automatic_updates', $exception, NULL, [], RfcLogLevel::INFO); + // HTTP 404 is expected for modules that aren't the main project. But + // other error codes should complain loudly. + if ($exception->getCode() !== 404) { throw $exception; } } diff --git a/src/Services/ModifiedFilesInterface.php b/src/Services/ModifiedFilesInterface.php index 44566d3b889916802e9721711025ec0a7cd90fde..ba46f254ee7d6c7c6eb6203118d3f3a1906326b5 100644 --- a/src/Services/ModifiedFilesInterface.php +++ b/src/Services/ModifiedFilesInterface.php @@ -13,12 +13,10 @@ interface ModifiedFilesInterface { * @param array $extensions * The list of extensions, keyed by extension name with values an info * array. - * @param bool $exception_on_failure - * (optional) Throw exception on HTTP failures, defaults to FALSE. * * @return \Iterator * The modified files. */ - public function getModifiedFiles(array $extensions = [], $exception_on_failure = FALSE); + public function getModifiedFiles(array $extensions = []); } diff --git a/tests/src/Functional/AutomaticUpdatesTest.php b/tests/src/Functional/AutomaticUpdatesTest.php index e2a9a9023d42a5237896476d131597c51e843bf6..9e2bae100e056e54827ac4c9dde917db170efd22 100644 --- a/tests/src/Functional/AutomaticUpdatesTest.php +++ b/tests/src/Functional/AutomaticUpdatesTest.php @@ -111,7 +111,7 @@ class AutomaticUpdatesTest extends BrowserTestBase { ->save(); $this->drupalGet(Url::fromRoute('automatic_updates.settings')); $this->clickLink('run the readiness checks'); - $this->assertSession()->pageTextContains('No issues found. Your site is completely ready for automatic updates.'); + $this->assertSession()->pageTextContains('No issues found. Your site is ready for automatic updates.'); } }