$wgUseMasterForMaintenance = true;
require_once( __DIR__ . '/Maintenance.php' );
+/**
+ * Maintenance script to run database schema updates.
+ *
+ * @ingroup Maintenance
+ */
class UpdateMediaWiki extends Maintenance {
function __construct() {
$shared = $this->hasOption( 'doshared' );
$updates = array( 'core', 'extensions', 'stats' );
- if( !$this->hasOption('nopurge') ) {
- $updates[] = 'purge';
- }
$updater = DatabaseUpdater::newForDb( $db, $shared, $this );
$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 );
+ }
+ }
+
+ if( !$this->hasOption('nopurge') ) {
+ $updater->purgeCache();
}
$this->output( "\nDone.\n" );