Index: trunk/phase3/maintenance/addwiki.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | |
17 | 17 | function addWiki( $lang, $site, $dbName ) |
18 | 18 | { |
19 | | - global $IP, $wgLanguageNames; |
| 19 | + global $IP, $wgLanguageNames, $wgDefaultExternalStore; |
20 | 20 | |
21 | 21 | $name = $wgLanguageNames[$lang]; |
22 | 22 | |
— | — | @@ -24,6 +24,7 @@ |
25 | 25 | $maintenance = "$IP/maintenance"; |
26 | 26 | |
27 | 27 | print "Creating database $dbName for $lang.$site\n"; |
| 28 | + |
28 | 29 | # Set up the database |
29 | 30 | $dbw->query( "SET table_type=Innodb" ); |
30 | 31 | $dbw->query( "CREATE DATABASE $dbName" ); |
— | — | @@ -34,6 +35,26 @@ |
35 | 36 | dbsource( "$IP/extensions/OAI/update_table.sql", $dbw ); |
36 | 37 | $dbw->query( "INSERT INTO site_stats(ss_row_id) VALUES (1)" ); |
37 | 38 | |
| 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 | + |
38 | 59 | $wgTitle = Title::newMainPage(); |
39 | 60 | $wgArticle = new Article( $wgTitle ); |
40 | 61 | $ucsite = ucfirst( $site ); |