Skip to content
Snippets Groups Projects
Commit 7512a3e9 authored by Lucas Hedding's avatar Lucas Hedding Committed by Lucas Hedding
Browse files

Issue #3097799 by heddn: Core files modifications not detected

parent e6e3c83d
No related branches found
No related tags found
No related merge requests found
......@@ -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');
}
......
......@@ -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
......
......@@ -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;
}
}
......
......@@ -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 = []);
}
......@@ -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.');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment