-# Initialise external storage
-if ( is_array( $wgDefaultExternalStore ) ) {
- $stores = $wgDefaultExternalStore;
-} elseif ( $wgDefaultExternalStore ) {
- $stores = array( $wgDefaultExternalStore );
-} else {
- $stores = array();
-}
-if ( count( $stores ) ) {
- require_once( 'ExternalStoreDB.php' );
- print "Initialising external storage $store...\n";
- global $wgDBuser, $wgDBpassword, $wgExternalServers;
- foreach ( $stores as $storeURL ) {
- $m = array();
- if ( !preg_match( '!^DB://(.*)$!', $storeURL, $m ) ) {
- continue;
+ if ( count( $stores ) ) {
+ $this->output( "Initialising external storage $store...\n" );
+ global $wgDBuser, $wgDBpassword, $wgExternalServers;
+ foreach ( $stores as $storeURL ) {
+ $m = array();
+ if ( !preg_match( '!^DB://(.*)$!', $storeURL, $m ) ) {
+ continue;
+ }
+
+ $cluster = $m[1];
+
+ # Hack
+ $wgExternalServers[$cluster][0]['user'] = $wgDBuser;
+ $wgExternalServers[$cluster][0]['password'] = $wgDBpassword;
+
+ $store = new ExternalStoreDB;
+ $extdb =& $store->getMaster( $cluster );
+ $extdb->query( "SET table_type=InnoDB" );
+ $extdb->query( "CREATE DATABASE {$to}" );
+ $extdb->query( "ALTER TABLE {$from}.blobs RENAME TO {$to}.blobs" );
+ $extdb->selectDB( $from );
+ $extdb->sourceFile( $this->getDir() . '/storage/blobs.sql' );
+ $extdb->immediateCommit();
+ }