Merge "revert gerrit change 29597 for TextContent constructor"
[lhc/web/wiklou.git] / maintenance / update.php
index 78e8827..cb6f06b 100644 (file)
@@ -34,6 +34,11 @@ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '
 $wgUseMasterForMaintenance = true;
 require_once( __DIR__ . '/Maintenance.php' );
 
+/**
+ * Maintenance script to run database schema updates.
+ *
+ * @ingroup Maintenance
+ */
 class UpdateMediaWiki extends Maintenance {
 
        function __construct() {
@@ -113,20 +118,27 @@ class UpdateMediaWiki extends Maintenance {
                $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" );