MarkAHershberger has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/59369


Change subject: Disable $wgContentHandlerUseDB during upgrade where fields 
don't exist.
......................................................................

Disable $wgContentHandlerUseDB during upgrade where fields don't exist.

They can cause problems if, for example, the installation has hooks
for UserSaveSettings or UserSaveOptions that try to update a user page.

Change-Id: I31078678e8939c897b1357bcb77eb2d26f806f29
Bug: 47271
---
M RELEASE-NOTES-1.21
M includes/installer/DatabaseUpdater.php
M includes/installer/MysqlUpdater.php
M includes/installer/OracleUpdater.php
M includes/installer/SqliteUpdater.php
5 files changed, 43 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/69/59369/1

diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21
index 2ab652b..0d0e309 100644
--- a/RELEASE-NOTES-1.21
+++ b/RELEASE-NOTES-1.21
@@ -130,6 +130,7 @@
   by adding a new configuration variable $wgApplyIpBlocksToXff (disabled by 
default).
 
 === Bug fixes in 1.21 ===
+* (bug 47271) $wgContentHandlerUseDB should be set to false during the upgrade
 * (bug 40617) Installer can now customize the logo in LocalSettings.php
 * (bug 40353) SpecialDoubleRedirect should support interwiki redirects.
 * (bug 40352) fixDoubleRedirects.php should support interwiki redirects.
diff --git a/includes/installer/DatabaseUpdater.php 
b/includes/installer/DatabaseUpdater.php
index f525319..d6800f5 100644
--- a/includes/installer/DatabaseUpdater.php
+++ b/includes/installer/DatabaseUpdater.php
@@ -89,6 +89,11 @@
        protected $skipSchema = false;
 
        /**
+        * Hold the value of $wgContentHandlerUseDB during the upgrade.
+        */
+       protected $wgContentHandlerUseDB = true;
+
+       /**
         * Constructor
         *
         * @param $db DatabaseBase object to perform updates on
@@ -998,4 +1003,30 @@
                $cl->execute();
                $this->output( "done.\n" );
        }
+
+       /**
+        * Turns off content handler fields during parts of the upgrade
+        * where they aren't available.
+        */
+       protected function disableContentHandlerUseDB() {
+               global $wgContentHandlerUseDB;
+
+               if( $wgContentHandlerUseDB ) {
+                       $this->output( "Turning off Content Handler DB fields 
for this part of upgrade.\n" );
+                       $this->holdContentHandlerUseDB = $wgContentHandlerUseDB;
+                       $wgContentHandlerUseDB = false;
+               }
+       }
+
+       /**
+        * Turns content handler fields back on.
+        */
+       protected function enableContentHandlerUseDB() {
+               global $wgContentHandlerUseDB;
+
+               if( $this->holdContentHandlerUseDB ) {
+                       $this->output( "Content Handler DB fields should be 
usable now.\n" );
+                       $wgContentHandlerUseDB = $this->holdContentHandlerUseDB;
+               }
+       }
 }
diff --git a/includes/installer/MysqlUpdater.php 
b/includes/installer/MysqlUpdater.php
index df1f610..b644c32 100644
--- a/includes/installer/MysqlUpdater.php
+++ b/includes/installer/MysqlUpdater.php
@@ -31,6 +31,8 @@
 
        protected function getCoreUpdateList() {
                return array(
+                       array( 'disableContentHandlerUseDB' ),
+
                        // 1.2
                        array( 'addField', 'ipblocks',      'ipb_id',           
'patch-ipblocks.sql' ),
                        array( 'addField', 'ipblocks',      'ipb_expiry',       
'patch-ipb_expiry.sql' ),
@@ -215,6 +217,8 @@
                        array( 'addField',      'archive',      
'ar_content_format',            'patch-archive-ar_content_format.sql' ),
                        array( 'addField',      'archive',      
'ar_content_model',                 'patch-archive-ar_content_model.sql' ),
                        array( 'addField',      'page',     
'page_content_model',               'patch-page-page_content_model.sql' ),
+                       array( 'enableContentHandlerUseDB' ),
+
                        array( 'dropField', 'site_stats',   'ss_admins',        
'patch-drop-ss_admins.sql' ),
                        array( 'dropField', 'recentchanges', 
'rc_moved_to_title',            'patch-rc_moved.sql' ),
                        array( 'addTable', 'sites',                            
'patch-sites.sql' ),
diff --git a/includes/installer/OracleUpdater.php 
b/includes/installer/OracleUpdater.php
index 56d9f21..8c26ec0 100644
--- a/includes/installer/OracleUpdater.php
+++ b/includes/installer/OracleUpdater.php
@@ -38,6 +38,8 @@
 
        protected function getCoreUpdateList() {
                return array(
+                       array( 'disableContentHandlerUseDB' ),
+
                        // 1.17
                        array( 'doNamespaceDefaults' ),
                        array( 'doFKRenameDeferr' ),
@@ -75,6 +77,8 @@
                        array( 'addField',      'archive',      
'ar_content_format',            'patch-archive-ar_content_format.sql' ),
                        array( 'addField',      'archive',      
'ar_content_model',                 'patch-archive-ar_content_model.sql' ),
                        array( 'addField',      'page',     
'page_content_model',               'patch-page-page_content_model.sql' ),
+                       array( 'enableContentHandlerUseDB' ),
+
                        array( 'dropField', 'site_stats', 'ss_admins',  
'patch-ss_admins.sql' ),
                        array( 'dropField', 'recentchanges', 
'rc_moved_to_title', 'patch-rc_moved.sql' ),
                        array( 'addTable', 'sites',                            
'patch-sites.sql' ),
diff --git a/includes/installer/SqliteUpdater.php 
b/includes/installer/SqliteUpdater.php
index 28d8d66..c35a7c6 100644
--- a/includes/installer/SqliteUpdater.php
+++ b/includes/installer/SqliteUpdater.php
@@ -31,6 +31,8 @@
 
        protected function getCoreUpdateList() {
                return array(
+                       array( 'disableContentHandlerUseDB' ),
+
                        // 1.14
                        array( 'addField', 'site_stats',    'ss_active_users',  
'patch-ss_active_users.sql' ),
                        array( 'doActiveUsersInit' ),
@@ -95,6 +97,7 @@
                        array( 'addField', 'archive',  'ar_content_format',  
'patch-archive-ar_content_format.sql' ),
                        array( 'addField', 'archive',  'ar_content_model',   
'patch-archive-ar_content_model.sql' ),
                        array( 'addField', 'page',     'page_content_model', 
'patch-page-page_content_model.sql' ),
+                       array( 'enableContentHandlerUseDB' ),
 
                        array( 'dropField', 'site_stats',    'ss_admins',       
  'patch-drop-ss_admins.sql' ),
                        array( 'dropField', 'recentchanges', 
'rc_moved_to_title', 'patch-rc_moved.sql' ),

-- 
To view, visit https://gerrit.wikimedia.org/r/59369
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I31078678e8939c897b1357bcb77eb2d26f806f29
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MarkAHershberger <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to