From b887cea9d125fe69e84aa6e3682b6f1228283540 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 12 Oct 2012 20:52:29 +0200 Subject: [PATCH] PostDatabaseUpdateMaintenance: childs checks updatelog already The parent class LoggedUpdateMaintenance of each update script is checking the updatelog self. Checking in update.php prevents the script to be run, when using --force on update.php and updater is not outputting a skipped message Change-Id: I6cdad807ee4e49983cedef168d4e697a5bd8b7e7 --- includes/installer/DatabaseUpdater.php | 6 ++++++ maintenance/update.php | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index a5753345d2..e00aef517c 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -54,6 +54,10 @@ abstract class DatabaseUpdater { protected $shared = false; + /** + * Scripts to run after database update + * Should be a subclass of LoggedUpdateMaintenance + */ protected $postDatabaseUpdateMaintenance = array( 'DeleteDefaultMessages', 'PopulateRevisionLength', @@ -254,6 +258,8 @@ abstract class DatabaseUpdater { /** * Add a maintenance script to be run after the database updates are complete. * + * Script should subclass LoggedUpdateMaintenance + * * @since 1.19 * * @param $class string Name of a Maintenance subclass diff --git a/maintenance/update.php b/maintenance/update.php index 877f1366a3..e3c993badc 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -126,12 +126,18 @@ class UpdateMediaWiki extends Maintenance { $updater->doUpdates( $updates ); foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) { - if ( $updater->updateRowExists( $maint ) ) { + $child = $this->runChild( $maint ); + + // LoggedUpdateMaintenance is checking the updatelog itself + $isLoggedUpdate = ( $child instanceof LoggedUpdateMaintenance ); + + if ( !$isLoggedUpdate && $updater->updateRowExists( $maint ) ) { continue; } - $child = $this->runChild( $maint ); $child->execute(); - $updater->insertUpdateRow( $maint ); + if ( !$isLoggedUpdate ) { + $updater->insertUpdateRow( $maint ); + } } $this->output( "\nDone.\n" ); -- 2.20.1