diff -u b/core/lib/Drupal/Core/Updater/Updater.php b/core/lib/Drupal/Core/Updater/Updater.php --- b/core/lib/Drupal/Core/Updater/Updater.php +++ b/core/lib/Drupal/Core/Updater/Updater.php @@ -215,50 +215,44 @@ * An array of links which the user may need to complete the update * * @throws \Drupal\Core\Updater\UpdaterException - * @throws \Drupal\Core\Updater\UpdaterFileTransferException */ public function update(&$filetransfer, $overrides = array()) { - try { - // Establish arguments with possible overrides. - $args = $this->getInstallArgs($overrides); - - // Take a Backup. - if ($args['make_backup']) { - $this->makeBackup($filetransfer, $args['install_dir'], $args['backup_dir']); - } - - if (!$this->name) { - // This is bad, don't want to delete the install directory. - throw new UpdaterException(t('Fatal error in update, cowardly refusing to wipe out the install directory.')); - } - - // Make sure the installation parent directory exists and is writable. - $this->prepareInstallDirectory($filetransfer, $args['install_dir']); - - // Note: If the project is installed in the top-level, it will not be - // deleted. It will be installed in sites/default as that will override - // the top-level reference and not break other sites which are using it. - if (is_dir($args['install_dir'] . '/' . $this->name)) { - // Remove the existing installed file. - $filetransfer->removeDirectory($args['install_dir'] . '/' . $this->name); - } - - // Copy the directory in place. - $filetransfer->copyDirectory($this->source, $args['install_dir']); - - // Make sure what we just installed is readable by the web server. - $this->makeWorldReadable($filetransfer, $args['install_dir'] . '/' . $this->name); - - // Run the updates. - // @todo Decide if we want to implement this. - $this->postUpdate(); + // Establish arguments with possible overrides. + $args = $this->getInstallArgs($overrides); - // For now, just return a list of links of things to do. - return $this->postUpdateTasks(); + // Take a Backup. + if ($args['make_backup']) { + $this->makeBackup($filetransfer, $args['install_dir'], $args['backup_dir']); } - catch (FileTransferException $e) { - throw new UpdaterFileTransferException(t('File Transfer failed, reason: @reason', array('@reason' => strtr($e->getMessage(), $e->arguments)))); + + if (!$this->name) { + // This is bad, don't want to delete the install directory. + throw new UpdaterException(t('Fatal error in update, cowardly refusing to wipe out the install directory.')); + } + + // Make sure the installation parent directory exists and is writable. + $this->prepareInstallDirectory($filetransfer, $args['install_dir']); + + // Note: If the project is installed in the top-level, it will not be + // deleted. It will be installed in sites/default as that will override + // the top-level reference and not break other sites which are using it. + if (is_dir($args['install_dir'] . '/' . $this->name)) { + // Remove the existing installed file. + $filetransfer->removeDirectory($args['install_dir'] . '/' . $this->name); } + + // Copy the directory in place. + $filetransfer->copyDirectory($this->source, $args['install_dir']); + + // Make sure what we just installed is readable by the web server. + $this->makeWorldReadable($filetransfer, $args['install_dir'] . '/' . $this->name); + + // Run the updates. + // @todo Decide if we want to implement this. + $this->postUpdate(); + + // For now, just return a list of links of things to do. + return $this->postUpdateTasks(); } /** @@ -271,32 +265,25 @@ * * @return array * An array of links which the user may need to complete the install. - * - * @throws \Drupal\Core\Updater\UpdaterFileTransferException */ public function install(&$filetransfer, $overrides = array()) { - try { - // Establish arguments with possible overrides. - $args = $this->getInstallArgs($overrides); - - // Make sure the installation parent directory exists and is writable. - $this->prepareInstallDirectory($filetransfer, $args['install_dir']); - - // Copy the directory in place. - $filetransfer->copyDirectory($this->source, $args['install_dir']); - - // Make sure what we just installed is readable by the web server. - $this->makeWorldReadable($filetransfer, $args['install_dir'] . '/' . $this->name); - - // Potentially enable something? - // @todo Decide if we want to implement this. - $this->postInstall(); - // For now, just return a list of links of things to do. - return $this->postInstallTasks(); - } - catch (FileTransferException $e) { - throw new UpdaterFileTransferException(t('File Transfer failed, reason: @reason', array('@reason' => strtr($e->getMessage(), $e->arguments)))); - } + // Establish arguments with possible overrides. + $args = $this->getInstallArgs($overrides); + + // Make sure the installation parent directory exists and is writable. + $this->prepareInstallDirectory($filetransfer, $args['install_dir']); + + // Copy the directory in place. + $filetransfer->copyDirectory($this->source, $args['install_dir']); + + // Make sure what we just installed is readable by the web server. + $this->makeWorldReadable($filetransfer, $args['install_dir'] . '/' . $this->name); + + // Potentially enable something? + // @todo Decide if we want to implement this. + $this->postInstall(); + // For now, just return a list of links of things to do. + return $this->postInstallTasks(); } /** diff -u b/core/modules/migrate/src/MigrateExecutable.php b/core/modules/migrate/src/MigrateExecutable.php --- b/core/modules/migrate/src/MigrateExecutable.php +++ b/core/modules/migrate/src/MigrateExecutable.php @@ -222,7 +222,7 @@ } catch (\Exception $e) { $this->message->display( - $this->t('Migration failed with source plugin exception: !e', array('!e' => $e->getMessage())), 'error'); + $this->t('Migration failed with source plugin exception: @e', array('@e' => $e->getMessage())), 'error'); $this->migration->setStatus(MigrationInterface::STATUS_IDLE); return MigrationInterface::RESULT_FAILED; } @@ -237,7 +237,7 @@ } catch (\Exception $e) { $this->message->display( - $this->t('Migration failed with source plugin exception: @e', array('@e' => $e->getMessage())), 'error'); + $this->t('Migration failed with source plugin exception: !e', array('!e' => $e->getMessage())), 'error'); $this->migration->setStatus(MigrationInterface::STATUS_IDLE); return MigrationInterface::RESULT_FAILED; } @@ -299,8 +299,8 @@ } catch (\Exception $e) { $this->message->display( - $this->t('Migration failed with source plugin exception: !e', - array('!e' => $e->getMessage())), 'error'); + $this->t('Migration failed with source plugin exception: @e', + array('@e' => $e->getMessage())), 'error'); $this->migration->setStatus(MigrationInterface::STATUS_IDLE); return MigrationInterface::RESULT_FAILED; } @@ -318,8 +318,8 @@ } catch (\Exception $e) { $this->message->display( - $this->t('Migration failed with source plugin exception: @e', - array('@e' => $e->getMessage())), 'error'); + $this->t('Migration failed with source plugin exception: !e', + array('!e' => $e->getMessage())), 'error'); $this->migration->setStatus(MigrationInterface::STATUS_IDLE); return MigrationInterface::RESULT_FAILED; } only in patch2: unchanged: --- a/core/modules/update/update.authorize.inc +++ b/core/modules/update/update.authorize.inc @@ -10,6 +10,7 @@ * the Update Manager module. */ +use Drupal\Core\FileTransfer\FileTransferException; use Drupal\Core\Updater\UpdaterException; use Drupal\Core\Url; @@ -177,9 +178,15 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url $tasks = $updater->install($filetransfer); } } + catch (FileTransferException $e) { + $message = t('File Transfer failed, reason: @reason', array('@reason' => strtr($e->getMessage(), $e->arguments))); + } catch (UpdaterException $e) { + $message = $e->getMessage(); + } + if (isset($message)) { _update_batch_create_message($context['results']['log'][$project], t('Error installing / updating'), FALSE); - _update_batch_create_message($context['results']['log'][$project], $e->getMessage(), FALSE); + _update_batch_create_message($context['results']['log'][$project], $message, FALSE); $context['results']['log'][$project]['#abort'] = TRUE; return; }