Index: branches/wmf/1.16wmf4/includes/db/DatabaseMysql.php |
— | — | @@ -115,8 +115,12 @@ |
116 | 116 | if( $wgDBmysql5 ) { |
117 | 117 | $this->query( 'SET NAMES utf8', __METHOD__ ); |
118 | 118 | } |
119 | | - // Turn off strict mode |
120 | | - $this->query( "SET sql_mode = ''", __METHOD__ ); |
| 119 | + // Set SQL mode, default is turning them all off, can be overridden or skipped with null |
| 120 | + global $wgSQLMode; |
| 121 | + if ( is_string( $wgSQLMode ) ) { |
| 122 | + $mode = $this->addQuotes( $wgSQLMode ); |
| 123 | + $this->query( "SET sql_mode = $mode", __METHOD__ ); |
| 124 | + } |
121 | 125 | } |
122 | 126 | |
123 | 127 | // Turn off strict mode if it is on |
Index: branches/wmf/1.16wmf4/includes/DefaultSettings.php |
— | — | @@ -617,6 +617,14 @@ |
618 | 618 | /** MySQL table options to use during installation or update */ |
619 | 619 | $wgDBTableOptions = 'ENGINE=InnoDB'; |
620 | 620 | |
| 621 | +/** |
| 622 | + * SQL Mode - default is turning off all modes, including strict, if set. |
| 623 | + * null can be used to skip the setting for performance reasons and assume |
| 624 | + * DBA has done his best job. |
| 625 | + * String override can be used for some additional fun :-) |
| 626 | + */ |
| 627 | +$wgSQLMode = ''; |
| 628 | + |
621 | 629 | /** Mediawiki schema */ |
622 | 630 | $wgDBmwschema = 'mediawiki'; |
623 | 631 | /** Tsearch2 schema */ |
Index: branches/wmf/1.16wmf4/RELEASE-NOTES |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | since Atom is a better protocol and is supported by virtually all clients. |
16 | 16 | |
17 | 17 | * It's now possible to block users from sending email via Special:Emailuser. |
| 18 | +* Added $wgSQLMode for setting database SQL modes - either performance (null) |
| 19 | + or other reasons (such as enabling stricter checks) |
18 | 20 | |
19 | 21 | * The maintenance script system was overhauled. Most maintenance scripts now |
20 | 22 | have a useful help page when you run them with --help. |