diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2008-08-15 01:29:47 +0200 |
commit | 370e83bb0dfd0c70de268c93bf07ad5ee0897192 (patch) | |
tree | 491674f4c242e4d6ba0d04eafa305174c35a3391 /maintenance/addwiki.php | |
parent | f4debf0f12d0524d2b2427c55ea3f16b680fad97 (diff) |
Update auf 1.13.0
Diffstat (limited to 'maintenance/addwiki.php')
-rw-r--r-- | maintenance/addwiki.php | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/maintenance/addwiki.php b/maintenance/addwiki.php index a19b24ce..b9c48506 100644 --- a/maintenance/addwiki.php +++ b/maintenance/addwiki.php @@ -1,4 +1,11 @@ <?php +/** + * Add a new wiki + * Wikimedia specific! + * + * @file + * @ingroup Maintenance + */ $wgNoDBParam = true; @@ -6,7 +13,7 @@ require_once( "commandLine.inc" ); require_once( "rebuildInterwiki.inc" ); require_once( "languages/Names.php" ); if ( count( $args ) != 3 ) { - wfDie( "Usage: php addwiki.php <language> <site> <dbname>\n" ); + wfDie( "Usage: php addwiki.php <language> <site> <dbname>\nThe site for Wikipedia is 'wikipedia'.\n" ); } addWiki( $args[0], $args[1], $args[2] ); @@ -17,13 +24,17 @@ function addWiki( $lang, $site, $dbName ) { global $IP, $wgLanguageNames, $wgDefaultExternalStore; + if ( !isset( $wgLanguageNames[$lang] ) ) { + print "Language $lang not found in \$wgLanguageNames\n"; + return; + } $name = $wgLanguageNames[$lang]; - $dbw = wfGetDB( DB_WRITE ); + $dbw = wfGetDB( DB_MASTER ); $common = "/home/wikipedia/common"; $maintenance = "$IP/maintenance"; - print "Creating database $dbName for $lang.$site\n"; + print "Creating database $dbName for $lang.$site ($name)\n"; # Set up the database $dbw->query( "SET table_type=Innodb" ); @@ -33,8 +44,12 @@ function addWiki( $lang, $site, $dbName ) print "Initialising tables\n"; dbsource( "$maintenance/tables.sql", $dbw ); dbsource( "$IP/extensions/OAI/update_table.sql", $dbw ); - dbsource( "$IP/extensions/AntiSpoof/mysql/patch-antispoof.sql", $dbw ); + dbsource( "$IP/extensions/AntiSpoof/sql/patch-antispoof.mysql.sql", $dbw ); dbsource( "$IP/extensions/CheckUser/cu_changes.sql", $dbw ); + dbsource( "$IP/extensions/CheckUser/cu_log.sql", $dbw ); + dbsource( "$IP/extensions/TitleKey/titlekey.sql", $dbw ); + dbsource( "$IP/extensions/Oversight/hidden.sql", $dbw ); + $dbw->query( "INSERT INTO site_stats(ss_row_id) VALUES (1)" ); # Initialise external storage @@ -72,7 +87,8 @@ function addWiki( $lang, $site, $dbName ) } global $wgTitle, $wgArticle; - $wgTitle = Title::newMainPage(); + $wgTitle = Title::newFromText( wfMsgWeirdKey( "mainpage/$lang" ) ); + print "Writing main page to " . $wgTitle->getPrefixedDBkey() . "\n"; $wgArticle = new Article( $wgTitle ); $ucsite = ucfirst( $site ); @@ -218,32 +234,16 @@ EOT fclose( $file ); # Update the sublists - system("cd $common && ./refresh-dblist"); + shell_exec("cd $common && ./refresh-dblist"); - print "Constructing interwiki SQL\n"; + #print "Constructing interwiki SQL\n"; # Rebuild interwiki tables - $sql = getRebuildInterwikiSQL(); - $tempname = tempnam( '/tmp', 'addwiki' ); - $file = fopen( $tempname, 'w' ); - if ( !$file ) { - wfDie( "Error, unable to open temporary file $tempname\n" ); - } - fwrite( $file, $sql ); - fclose( $file ); - print "Sourcing interwiki SQL\n"; - dbsource( $tempname, $dbw ); - #unlink( $tempname ); - - # Create the upload dir - global $wgUploadDirectory; - if( file_exists( $wgUploadDirectory ) ) { - echo "$wgUploadDirectory already exists.\n"; - } else { - echo "Creating $wgUploadDirectory...\n"; - mkdir( $wgUploadDirectory, 0777 ); - chmod( $wgUploadDirectory, 0777 ); - } + #passthru( '/home/wikipedia/conf/interwiki/update' ); - print "Script ended. You now want to run sync-common-all to publish *dblist files (check them for duplicates first)\n"; + print "Script ended. You still have to: +* Add any required settings in InitialiseSettings.php +* Run sync-common-all +* Run /home/wikipedia/conf/interwiki/update +"; } |