Adding $wgSQLMode
authorDomas Mituzas <midom@users.mediawiki.org>
Fri, 25 Jun 2010 09:19:34 +0000 (09:19 +0000)
committerDomas Mituzas <midom@users.mediawiki.org>
Fri, 25 Jun 2010 09:19:34 +0000 (09:19 +0000)
* default is disabling all modes ('')
* null disables the SET operation (we will use this at WMF deployment)
* String override can be used as configuration parameter

RELEASE-NOTES
includes/DefaultSettings.php
includes/db/DatabaseMysql.php

index a1d3b20..51495f4 100644 (file)
@@ -38,6 +38,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Added $wgJQueryVersion, $wgJQueryMinified and $wgJQueryOnEveryPage (true by
   default) to configure loading of jQuery by MediaWiki.
 * XmlFunctions.php has been removed. Use the Xml or Html classes as appropriate.
+* Added $wgSQLMode for setting database SQL modes - either performance (null)
+  or other reasons (such as enabling stricter checks)
 
 === New features in 1.17 ===
 * (bug 10183) Users can now add personal styles and scripts to all skins via
index f2c3b33..f21e4eb 100644 (file)
@@ -1123,6 +1123,14 @@ $wgDBprefix         = '';
 /** MySQL table options to use during installation or update */
 $wgDBTableOptions   = 'ENGINE=InnoDB';
 
+/**
+ * SQL Mode - default is turning off all modes, including strict, if set.
+ * null can be used to skip the setting for performance reasons and assume 
+ * DBA has done his best job.
+ * String override can be used for some additional fun :-)
+ */
+$wgSQLMode = ''; 
+
 /** Mediawiki schema */
 $wgDBmwschema       = 'mediawiki';
 /** Tsearch2 schema */
index 68a7fee..a23b7d2 100644 (file)
@@ -113,8 +113,10 @@ class DatabaseMysql extends DatabaseBase {
                                if( $wgDBmysql5 ) {
                                        $this->query( 'SET NAMES utf8', __METHOD__ );
                                }
-                               // Turn off strict mode
-                               $this->query( "SET sql_mode = ''", __METHOD__ );
+                               // Set SQL mode, default is turning them all off, can be overridden or skipped with null
+                               if (is_string($wgSQLMode)) {
+                                       $this->query( "SET sql_mode = '$wgSQLMode'", __METHOD__ );
+                               }
                        }
 
                        // Turn off strict mode if it is on