r34199 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34198‎ | r34199 | r34200 >
Date:09:00, 4 May 2008
Author:dantman
Status:old
Tags:
Comment:
New variable $wgSharedDBtables. This allows altering of the list of tables which enabling $wgSharedDB affects. For backwards compatibility this is set to an array containing the user table.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Database.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -587,6 +587,19 @@
588588 $wgSharedDB = null;
589589
590590 /**
 591+ * List of database tables (without prefixes) to share when $wgSharedDB is enabled.
 592+ * This only includes the user table by default for backwards compatibility.
 593+ * However you may remove it so that you can enable extensions using the shared DB
 594+ * without having shared users. Or you can add in another table, such as interwiki
 595+ * to force MediaWiki to use the shared version of the table instead.
 596+ *
 597+ * Be carefull with sharing tables. The images, revisions, pages, and many of the
 598+ * other tables may have bad side effects if you share them.
 599+ * EXPERIMENTAL
 600+ */
 601+$wgSharedDBtables = array( 'user' );
 602+
 603+/**
591604 * Database load balancer
592605 * This is a two-dimensional array, an array of server info structures
593606 * Fields are:
Index: trunk/phase3/includes/Database.php
@@ -1365,13 +1365,15 @@
13661366 * @param string $name database table name
13671367 */
13681368 function tableName( $name ) {
1369 - global $wgSharedDB;
 1369+ global $wgSharedDB, $wgSharedDBtables;
13701370 # Skip quoted literals
13711371 if ( $name{0} != '`' ) {
13721372 if ( $this->mTablePrefix !== '' && strpos( $name, '.' ) === false ) {
13731373 $name = "{$this->mTablePrefix}$name";
13741374 }
1375 - if ( isset( $wgSharedDB ) && "{$this->mTablePrefix}user" == $name ) {
 1375+ if ( isset( $wgSharedDB ) && isset( $wgSharedDBtables )
 1376+ && substr( $name, 0, strlen($this->mTablePrefix) ) == $this->mTablePrefix
 1377+ && in_array( substr( $name, strlen($this->mTablePrefix) ), $wgSharedDBtables ) ) {
13761378 $name = "`$wgSharedDB`.`$name`";
13771379 } else {
13781380 # Standard quoting
Index: trunk/phase3/RELEASE-NOTES
@@ -99,6 +99,8 @@
100100 * (bug 709) Cannot rename/move images and other media files [EXPERIMENTAL]
101101 * Custom rollback summaries now accept the same arguments as the default message
102102 * (bug 12542) Added hooks for expansion of Special:Listusers
 103+* Added new variable $wgSharedDBtables for altering the list of tables which are
 104+ shared when $wgSharedDB is enabled.
103105
104106 === Bug fixes in 1.13 ===
105107

Follow-up revisions

RevisionCommit summaryAuthorDate
r34278Revert r34199, r34205 for now....brion22:21, 5 May 2008

Status & tagging log