MarkAHershberger has uploaded a new change for review.

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


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, 49 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/80/60780/1

diff --git a/RELEASE-NOTES-1.21 b/RELEASE-NOTES-1.21
index 33acbf8..06f879c 100644
--- a/RELEASE-NOTES-1.21
+++ b/RELEASE-NOTES-1.21
@@ -122,8 +122,15 @@
 * (bug 45526) Add QUnit assertion helper "QUnit.assert.htmlEqual" for asserting
   structual equality of HTML (ignoring insignificant differences like
   quotmarks, order and whitespace in the attribute list).
+* (bug 23393) HTML <hN> headings containing line breaks are now handled
+  correctly.
+* (bug 45803) Whitespace within == Headline == syntax and within <hN> headings
+  is now non-significant and not preserved in the HTML output.
+* (bug 23343) Implemented ability to apply IP blocks to the contents of 
X-Forwarded-For headers
+  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 46084) Sanitize $limitReport before outputting.
 * (bug 46859) Disable external entities in XMLReader.
 * (bug 47251) Disable external entities in Import.
diff --git a/includes/installer/DatabaseUpdater.php 
b/includes/installer/DatabaseUpdater.php
index f190196..25f751c 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 d8fa64e..9d73e62 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' ),
@@ -218,6 +220,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 cafe8cd..b416f4b 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 11e3445..2064842 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' ),
@@ -97,6 +99,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/60780
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: REL1_21
Gerrit-Owner: MarkAHershberger <[email protected]>

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

Reply via email to