From fea79bb25b74ae076e0360e6076706f83c791892 Mon Sep 17 00:00:00 2001 From: phenaproxima <phenaproxima@205645.no-reply.drupal.org> Date: Thu, 6 Oct 2022 18:33:57 +0000 Subject: [PATCH] Issue #3313717 by phenaproxima, tedbow, balsama: Improve the wording of UpdateException when re-throwing an ApplyFailedException --- src/Updater.php | 2 +- tests/src/Functional/UpdaterFormTest.php | 2 +- tests/src/Kernel/CronUpdaterTest.php | 2 +- tests/src/Kernel/UpdaterTest.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Updater.php b/src/Updater.php index 68e7c1b0a3..3f25f17e4f 100644 --- a/src/Updater.php +++ b/src/Updater.php @@ -114,7 +114,7 @@ class Updater extends Stage { parent::apply($timeout); } catch (ApplyFailedException $exception) { - throw new UpdateException([], 'The update operation failed to apply. The update may have been partially applied. It is recommended that the site be restored from a code backup.', $exception->getCode(), $exception); + throw new UpdateException([], "The update operation failed to apply completely. All the files necessary to run Drupal correctly and securely are probably not present. It is strongly recommended to restore your site's code and database from a backup.", $exception->getCode(), $exception); } } diff --git a/tests/src/Functional/UpdaterFormTest.php b/tests/src/Functional/UpdaterFormTest.php index 4548dd4071..d0b976e991 100644 --- a/tests/src/Functional/UpdaterFormTest.php +++ b/tests/src/Functional/UpdaterFormTest.php @@ -336,7 +336,7 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase { $page->pressButton('Continue'); $this->checkForMetaRefresh(); $assert_session->pageTextContainsOnce('An error has occurred.'); - $assert_session->pageTextContains('The update operation failed to apply. The update may have been partially applied. It is recommended that the site be restored from a code backup.'); + $assert_session->pageTextContains("The update operation failed to apply completely. All the files necessary to run Drupal correctly and securely are probably not present. It is strongly recommended to restore your site's code and database from a backup."); $page->clickLink('the error page'); $failure_message = 'Automatic updates failed to apply, and the site is in an indeterminate state. Consider restoring the code and database from a backup.'; diff --git a/tests/src/Kernel/CronUpdaterTest.php b/tests/src/Kernel/CronUpdaterTest.php index c0d0a16391..da321e21b6 100644 --- a/tests/src/Kernel/CronUpdaterTest.php +++ b/tests/src/Kernel/CronUpdaterTest.php @@ -511,7 +511,7 @@ END; $expected_body = <<<END Drupal core failed to update automatically from 9.8.0 to 9.8.1. The following error was logged: -The update operation failed to apply. The update may have been partially applied. It is recommended that the site be restored from a code backup. +The update operation failed to apply completely. All the files necessary to run Drupal correctly and securely are probably not present. It is strongly recommended to restore your site's code and database from a backup. This e-mail was sent by the Automatic Updates module. Unattended updates are not yet fully supported. diff --git a/tests/src/Kernel/UpdaterTest.php b/tests/src/Kernel/UpdaterTest.php index 4d395c02bf..916cf0315e 100644 --- a/tests/src/Kernel/UpdaterTest.php +++ b/tests/src/Kernel/UpdaterTest.php @@ -181,7 +181,7 @@ class UpdaterTest extends AutomaticUpdatesKernelTestBase { Committer::setException(new $thrown_class($thrown_message, 123)); $this->expectException($expected_class); $expected_message = $expected_class === UpdateException::class ? - 'The update operation failed to apply. The update may have been partially applied. It is recommended that the site be restored from a code backup.' + "The update operation failed to apply completely. All the files necessary to run Drupal correctly and securely are probably not present. It is strongly recommended to restore your site's code and database from a backup." : $thrown_message; $this->expectExceptionMessage($expected_message); $this->expectExceptionCode(123); -- GitLab