New variable $wgSharedDBtables. This allows altering of the list of tables which...
authorDaniel Friesen <dantman@users.mediawiki.org>
Sun, 4 May 2008 09:00:17 +0000 (09:00 +0000)
committerDaniel Friesen <dantman@users.mediawiki.org>
Sun, 4 May 2008 09:00:17 +0000 (09:00 +0000)
RELEASE-NOTES
includes/Database.php
includes/DefaultSettings.php

index fd412d9..2b2e4c0 100644 (file)
@@ -99,6 +99,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 709) Cannot rename/move images and other media files [EXPERIMENTAL]
 * Custom rollback summaries now accept the same arguments as the default message
 * (bug 12542) Added hooks for expansion of Special:Listusers
+* Added new variable $wgSharedDBtables for altering the list of tables which are
+  shared when $wgSharedDB is enabled.
 
 === Bug fixes in 1.13 ===
 
index 1f19226..2b20d98 100644 (file)
@@ -1365,13 +1365,15 @@ class Database {
         * @param string $name database table name
         */
        function tableName( $name ) {
-               global $wgSharedDB;
+               global $wgSharedDB, $wgSharedDBtables;
                # Skip quoted literals
                if ( $name{0} != '`' ) {
                        if ( $this->mTablePrefix !== '' &&  strpos( $name, '.' ) === false ) {
                                $name = "{$this->mTablePrefix}$name";
                        }
-                       if ( isset( $wgSharedDB ) && "{$this->mTablePrefix}user" == $name ) {
+                       if ( isset( $wgSharedDB ) && isset( $wgSharedDBtables )
+                        && substr( $name, 0, strlen($this->mTablePrefix) ) == $this->mTablePrefix
+                        && in_array( substr( $name, strlen($this->mTablePrefix) ), $wgSharedDBtables ) ) {
                                $name = "`$wgSharedDB`.`$name`";
                        } else {
                                # Standard quoting
index 92dac4a..3ee9ea4 100644 (file)
@@ -586,6 +586,19 @@ $wgCheckDBSchema = true;
  */
 $wgSharedDB = null;
 
+/**
+ * List of database tables (without prefixes) to share when $wgSharedDB is enabled.
+ * This only includes the user table by default for backwards compatibility.
+ * However you may remove it so that you can enable extensions using the shared DB
+ * without having shared users. Or you can add in another table, such as interwiki
+ * to force MediaWiki to use the shared version of the table instead.
+ * 
+ * Be carefull with sharing tables. The images, revisions, pages, and many of the
+ * other tables may have bad side effects if you share them.
+ * EXPERIMENTAL
+ */
+$wgSharedDBtables = array( 'user' );
+
 /**
  * Database load balancer
  * This is a two-dimensional array, an array of server info structures