Merge "(bug 39490) Add caching to InfoAction."
[lhc/web/wiklou.git] / includes / installer / MysqlUpdater.php
index 7cf382b..bbeb685 100644 (file)
@@ -155,8 +155,8 @@ class MysqlUpdater extends DatabaseUpdater {
                        // 1.15
                        array( 'doUniquePlTlIl' ),
                        array( 'addTable', 'change_tag',                        'patch-change_tag.sql' ),
-                       array( 'addTable', 'tag_summary',                       'patch-change_tag.sql' ),
-                       array( 'addTable', 'valid_tag',                         'patch-change_tag.sql' ),
+                       /* array( 'addTable', 'tag_summary',                       'patch-change_tag.sql' ), */
+                       /* array( 'addTable', 'valid_tag',                         'patch-change_tag.sql' ), */
 
                        // 1.16
                        array( 'addTable', 'user_properties',                   'patch-user_properties.sql' ),
@@ -226,6 +226,8 @@ class MysqlUpdater extends DatabaseUpdater {
                        array( 'addField', 'filearchive',   'fa_sha1',          'patch-fa_sha1.sql' ),
                        array( 'addField', 'job',           'job_token',         'patch-job_token.sql' ),
                        array( 'addField', 'job',           'job_attempts',       'patch-job_attempts.sql' ),
+                       array( 'doEnableProfiling' ),
+                       array( 'addField', 'uploadstash',      'us_props',      'patch-uploadstash-us_props.sql' ),
                );
        }
 
@@ -640,6 +642,9 @@ class MysqlUpdater extends DatabaseUpdater {
         */
        protected function doWatchlistNull() {
                $info = $this->db->fieldInfo( 'watchlist', 'wl_notificationtimestamp' );
+               if ( !$info ) {
+                       return;
+               }
                if ( $info->isNullable() ) {
                        $this->output( "...wl_notificationtimestamp is already nullable.\n" );
                        return;
@@ -772,14 +777,21 @@ class MysqlUpdater extends DatabaseUpdater {
                }
        }
 
+       protected function doEnableProfiling() {
+               global $wgProfileToDatabase;
+               if ( $wgProfileToDatabase === true && ! $this->db->tableExists( 'profiling', __METHOD__ ) ) {
+                       $this->applyPatch( 'patch-profiling.sql', false, 'Add profiling table' );
+               }
+       }
+
        protected function doMaybeProfilingMemoryUpdate() {
                if ( !$this->db->tableExists( 'profiling', __METHOD__ ) ) {
-                       // Simply ignore
+                       return true;
                } elseif ( $this->db->fieldExists( 'profiling', 'pf_memory', __METHOD__ ) ) {
                        $this->output( "...profiling table has pf_memory field.\n" );
-               } else {
-                       $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
+                       return true;
                }
+               return $this->applyPatch( 'patch-profiling-memory.sql', false, "Adding pf_memory field to table profiling" );
        }
 
        protected function doFilearchiveIndicesUpdate() {
@@ -787,16 +799,21 @@ class MysqlUpdater extends DatabaseUpdater {
                if ( !$info ) {
                        $this->applyPatch( 'patch-filearchive-user-index.sql', false, "Updating filearchive indices" );
                }
+               return true;
        }
 
        protected function doUniquePlTlIl() {
                $info = $this->db->indexInfo( 'pagelinks', 'pl_namespace' );
                if ( is_array( $info ) && !$info[0]->Non_unique ) {
                        $this->output( "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n" );
-                       return;
+                       return true;
+               }
+               if ( $this->skipSchema ) {
+                       $this->output( "...skipping schema change (making pl_namespace, tl_namespace and il_to indices UNIQUE).\n" );
+                       return false;
                }
 
-               $this->applyPatch( 'patch-pl-tl-il-unique.sql', false, "Making pl_namespace, tl_namespace and il_to indices UNIQUE" );
+               return $this->applyPatch( 'patch-pl-tl-il-unique.sql', false, "Making pl_namespace, tl_namespace and il_to indices UNIQUE" );
        }
 
        protected function renameEuWikiId() {
@@ -840,6 +857,9 @@ class MysqlUpdater extends DatabaseUpdater {
 
        protected function doUserNewTalkTimestampNotNull() {
                $info = $this->db->fieldInfo( 'user_newtalk', 'user_last_timestamp' );
+               if ( $info === false ) {
+                       return;
+               }
                if ( $info->isNullable() ) {
                        $this->output( "...user_last_timestamp is already nullable.\n" );
                        return;