r68558 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68557‎ | r68558 | r68559 >
Date:09:19, 25 June 2010
Author:midom
Status:resolved (Comments)
Tags:
Comment:
Adding $wgSQLMode
* 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
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseMysql.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/DatabaseMysql.php
@@ -113,8 +113,10 @@
114114 if( $wgDBmysql5 ) {
115115 $this->query( 'SET NAMES utf8', __METHOD__ );
116116 }
117 - // Turn off strict mode
118 - $this->query( "SET sql_mode = ''", __METHOD__ );
 117+ // Set SQL mode, default is turning them all off, can be overridden or skipped with null
 118+ if (is_string($wgSQLMode)) {
 119+ $this->query( "SET sql_mode = '$wgSQLMode'", __METHOD__ );
 120+ }
119121 }
120122
121123 // Turn off strict mode if it is on
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1123,6 +1123,14 @@
11241124 /** MySQL table options to use during installation or update */
11251125 $wgDBTableOptions = 'ENGINE=InnoDB';
11261126
 1127+/**
 1128+ * SQL Mode - default is turning off all modes, including strict, if set.
 1129+ * null can be used to skip the setting for performance reasons and assume
 1130+ * DBA has done his best job.
 1131+ * String override can be used for some additional fun :-)
 1132+ */
 1133+$wgSQLMode = '';
 1134+
11271135 /** Mediawiki schema */
11281136 $wgDBmwschema = 'mediawiki';
11291137 /** Tsearch2 schema */
Index: trunk/phase3/RELEASE-NOTES
@@ -38,6 +38,8 @@
3939 * Added $wgJQueryVersion, $wgJQueryMinified and $wgJQueryOnEveryPage (true by
4040 default) to configure loading of jQuery by MediaWiki.
4141 * XmlFunctions.php has been removed. Use the Xml or Html classes as appropriate.
 42+* Added $wgSQLMode for setting database SQL modes - either performance (null)
 43+ or other reasons (such as enabling stricter checks)
4244
4345 === New features in 1.17 ===
4446 * (bug 10183) Users can now add personal styles and scripts to all skins via

Follow-up revisions

RevisionCommit summaryAuthorDate
r68559r68558 fixes: add some escaping (just in case, not really needed), as well as...midom09:36, 25 June 2010
r68713merging in r68558 and r68559midom08:12, 29 June 2010

Comments

#Comment by Bryan (talk | contribs)   19:47, 25 June 2010

Is this MySQL specific? In that case it might be better named $wgMySQLMode or something like that.

#Comment by Midom (talk | contribs)   10:42, 28 June 2010

SQL modes are actually not MySQL specific (e.g. MS Access has "ANSI mode" :)

Status & tagging log