From: umherirrender Date: Fri, 12 Oct 2012 18:52:29 +0000 (+0200) Subject: PostDatabaseUpdateMaintenance: childs checks updatelog already X-Git-Tag: 1.31.0-rc.0~22040^2 X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=commitdiff_plain;h=b887cea9d125fe69e84aa6e3682b6f1228283540;p=lhc%2Fweb%2Fwiklou.git 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 --- 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" );