From b001cf3b6d4bb076a8e81f1d7f0842baa4b26bc7 Mon Sep 17 00:00:00 2001 From: lucashedding <lucashedding@1463982.no-reply.drupal.org> Date: Mon, 9 Dec 2019 10:12:52 -0600 Subject: [PATCH] Issue #3094513 by heddn: Try/catch /Exception to rollback entire update if anything happens --- drupalci.yml | 5 ----- src/Services/InPlaceUpdate.php | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drupalci.yml b/drupalci.yml index d366f48b58..29bee715f5 100644 --- a/drupalci.yml +++ b/drupalci.yml @@ -9,11 +9,6 @@ build: sniff-all-files: true halt-on-fail: true testing: - container_command: - commands: - - cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2019-10-07/3085728.patch | git apply - - - cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2019-10-16/3088400-8_0.patch | git apply - - - cd ${SOURCE_DIR} && sudo -u www-data curl https://www.drupal.org/files/issues/2019-10-16/3088447.patch | git apply - # run_tests task is executed several times in order of performance speeds. # halt-on-fail can be set on the run_tests tasks in order to fail fast. # suppress-deprecations is false in order to be alerted to usages of diff --git a/src/Services/InPlaceUpdate.php b/src/Services/InPlaceUpdate.php index 21ab7a14a6..6a7e74f331 100644 --- a/src/Services/InPlaceUpdate.php +++ b/src/Services/InPlaceUpdate.php @@ -149,8 +149,18 @@ class InPlaceUpdate implements UpdateInterface { $modified = $this->checkModifiedFiles($metadata, $archive); if (!$modified && $this->backup($archive, $project_root)) { $this->logger->info('In place update has started.'); - $success = $this->processUpdate($archive, $project_root); - $this->logger->info('In place update has finished.'); + try { + $success = $this->processUpdate($archive, $project_root); + $this->logger->info('In place update has finished.'); + } + catch (\Throwable $throwable) { + $this->logger->info('In place update failed.'); + watchdog_exception($throwable); + } + catch (\Exception $exception) { + $this->logger->info('In place update failed.'); + watchdog_exception($exception); + } if ($success) { $process = automatic_updates_console_command('updatedb:status'); if ($success && $process->getOutput()) { -- GitLab