r12595 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12594‎ | r12595 | r12596 >
Date:01:02, 11 January 2006
Author:timstarling
Status:old
Tags:
Comment:
Initialise external storage
Modified paths:
  • /trunk/phase3/maintenance/addwiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/addwiki.php
@@ -15,7 +15,7 @@
1616
1717 function addWiki( $lang, $site, $dbName )
1818 {
19 - global $IP, $wgLanguageNames;
 19+ global $IP, $wgLanguageNames, $wgDefaultExternalStore;
2020
2121 $name = $wgLanguageNames[$lang];
2222
@@ -24,6 +24,7 @@
2525 $maintenance = "$IP/maintenance";
2626
2727 print "Creating database $dbName for $lang.$site\n";
 28+
2829 # Set up the database
2930 $dbw->query( "SET table_type=Innodb" );
3031 $dbw->query( "CREATE DATABASE $dbName" );
@@ -34,6 +35,26 @@
3536 dbsource( "$IP/extensions/OAI/update_table.sql", $dbw );
3637 $dbw->query( "INSERT INTO site_stats(ss_row_id) VALUES (1)" );
3738
 39+ # Initialise external storage
 40+ if ( $wgDefaultExternalStore && preg_match( '!^DB://(.*)$!', $wgDefaultExternalStore, $m ) ) {
 41+ print "Initialising external storage...\n";
 42+ require_once( 'ExternalStoreDB.php' );
 43+ global $wgDBuser, $wgDBpassword, $wgExternalServers;
 44+ $cluster = $m[1];
 45+
 46+ # Hack
 47+ $wgExternalServers[$cluster][0]['user'] = $wgDBuser;
 48+ $wgExternalServers[$cluster][0]['password'] = $wgDBpassword;
 49+
 50+ $store = new ExternalStoreDB;
 51+ $extdb =& $store->getMaster( $cluster );
 52+ $extdb->query( "SET table_type=InnoDB" );
 53+ $extdb->query( "CREATE DATABASE $dbName" );
 54+ $extdb->selectDB( $dbName );
 55+ dbsource( "$maintenance/storage/blobs.sql", $extdb );
 56+ $extdb->immediateCommit();
 57+ }
 58+
3859 $wgTitle = Title::newMainPage();
3960 $wgArticle = new Article( $wgTitle );
4061 $ucsite = ucfirst( $site );

Status & tagging log