* (bug 3649) Remove obsolete, broken moveCustomMessages script
* (bug 3291) 'last' diff link for last history line when not at end
* Avoid numerous redundant latest-revision lookups in history
+* Ability to set the table name for external storage servers
=== Caveats ===
var $mFlags;
var $mTrxLevel = 0;
var $mErrorCount = 0;
+ var $mLBInfo = array();
/**#@-*/
#------------------------------------------------------------------------------
return wfSetVar( $this->mErrorCount, $count );
}
+ /**
+ * Properties passed down from the server info array of the load balancer
+ */
+ function getLBInfo( $name = NULL ) {
+ if ( is_null( $name ) ) {
+ return $this->mLBInfo;
+ } else {
+ if ( array_key_exists( $name, $this->mLBInfo ) ) {
+ return $this->mLBInfo[$name];
+ } else {
+ return NULL;
+ }
+ }
+ }
+
+ function setLBInfo( $name, $value = NULL ) {
+ if ( is_null( $value ) ) {
+ $this->mLBInfo = $name;
+ } else {
+ $this->mLBInfo[$name] = $value;
+ }
+ }
+
/**#@+
* Get function
*/
# DBO_IGNORE -- ignore errors (not useful in LocalSettings.php)
# DBO_NOBUFFER -- turn off buffering (not useful in LocalSettings.php)
#
+# max lag: (optional) Maximum replication lag before a slave will taken out of rotation
+# max threads: (optional) Maximum number of running threads
+#
+# These and any other user-defined properties will be assigned to the mLBInfo member
+# variable of the Database object.
+#
# Leave at false to use the single-server variables above
$wgDBservers = false;
$lb =& $this->getLoadBalancer( $cluster );
return $lb->getConnection( DB_MASTER );
}
+
+ function getTable( &$db ) {
+ $table = $db->getLBInfo( 'blobs table' );
+ if ( is_null( $table ) ) {
+ $table = 'blobs';
+ }
+ return $table;
+ }
function fetchFromURL($url) {
global $wgExternalServers;
wfDebug( "ExternalStoreDB::fetchBlob cache miss on $cacheID\n" );
$dbr =& $this->getSlave( $cluster );
- $ret = $dbr->selectField( 'blobs', 'blob_text', array( 'blob_id' => $id ) );
+ $ret = $dbr->selectField( $this->getTable( $dbr ), 'blob_text', array( 'blob_id' => $id ) );
if( $itemID !== false ) {
// Unserialise object; caller extracts item
$ret = unserialize( $ret );
$dbw =& $this->getMaster( $cluster );
$id = $dbw->nextSequenceValue( 'blob_blob_id_seq' );
- $dbw->insert( 'blobs', array( 'blob_id' => $id, 'blob_text' => $data ), $fname );
+ $dbw->insert( $this->getTable( $dbw ), array( 'blob_id' => $id, 'blob_text' => $data ), $fname );
return "DB://$cluster/" . $dbw->insertId();
}
}
}
# Create object
- return new $class( $host, $user, $password, $dbname, 1, $flags );
+ $db = new $class( $host, $user, $password, $dbname, 1, $flags );
+ $db->setLBInfo( $server );
+ return $db;
}
function reportConnectionError( &$conn )