From 9e8f157ed258060e9762fbaa5195f4c8417bf536 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 22 Sep 2016 20:42:38 -0700 Subject: [PATCH] Minor installer/upgrader cleanups Change-Id: I6352d16dce242c94203bdf7d020f1c0279fec6e5 --- includes/installer/DatabaseInstaller.php | 8 ++++++-- includes/installer/DatabaseUpdater.php | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 4f10367e6a..2b84144a3f 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -167,7 +167,7 @@ abstract class DatabaseInstaller { * * @param string $sourceFileMethod * @param string $stepName - * @param string $archiveTableMustNotExist + * @param bool $archiveTableMustNotExist * @return Status */ private function stepApplySourceFile( @@ -353,10 +353,14 @@ abstract class DatabaseInstaller { $up = DatabaseUpdater::newForDB( $this->db ); try { $up->doUpdates(); - } catch ( Exception $e ) { + } catch ( MWException $e ) { echo "\nAn error occurred:\n"; echo $e->getText(); $ret = false; + } catch ( Exception $e ) { + echo "\nAn error occurred:\n"; + echo $e->getMessage(); + $ret = false; } $up->purgeCache(); ob_end_flush(); diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index 0d0da080fa..2425005ff8 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -20,6 +20,7 @@ * @file * @ingroup Deployment */ +use MediaWiki\MediaWikiServices; require_once __DIR__ . '/../../maintenance/Maintenance.php'; @@ -456,6 +457,8 @@ abstract class DatabaseUpdater { * @param bool $passSelf Whether to pass this object we calling external functions */ private function runUpdates( array $updates, $passSelf ) { + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $updatesDone = []; $updatesSkipped = []; foreach ( $updates as $params ) { @@ -470,7 +473,7 @@ abstract class DatabaseUpdater { flush(); if ( $ret !== false ) { $updatesDone[] = $origParams; - wfGetLBFactory()->waitForReplication(); + $lbFactory->waitForReplication(); } else { $updatesSkipped[] = [ $func, $params, $origParams ]; } -- 2.20.1