From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- maintenance/addwiki.php | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'maintenance/addwiki.php') diff --git a/maintenance/addwiki.php b/maintenance/addwiki.php index 0cb4d74a..e86a8c5d 100644 --- a/maintenance/addwiki.php +++ b/maintenance/addwiki.php @@ -27,15 +27,16 @@ * @ingroup Wikimedia */ -require_once( dirname(__FILE__) . '/Maintenance.php' ); +require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class AddWiki extends Maintenance { public function __construct() { parent::__construct(); $this->mDescription = "Add a new wiki to the family. Wikimedia specific!"; - $this->addArg( 'language', 'Language code of new site' ); - $this->addArg( 'site', 'Type of site' ); - $this->addArg( 'dbname', 'Name of database to create' ); + $this->addArg( 'language', 'Language code of new site, e.g. en' ); + $this->addArg( 'site', 'Type of site, e.g. wikipedia' ); + $this->addArg( 'dbname', 'Name of database to create, e.g. enwiki' ); + $this->addArg( 'domain', 'Domain name of the wiki, e.g. en.wikipedia.org' ); } public function getDbType() { @@ -43,17 +44,19 @@ class AddWiki extends Maintenance { } public function execute() { - global $IP, $wgLanguageNames, $wgDefaultExternalStore, $wgNoDBParam; + global $IP, $wgDefaultExternalStore, $wgNoDBParam; $wgNoDBParam = true; - $lang = $this->getArg(0); - $site = $this->getArg(1); - $dbName = $this->getArg(2); + $lang = $this->getArg( 0 ); + $site = $this->getArg( 1 ); + $dbName = $this->getArg( 2 ); + $domain = $this->getArg( 3 ); + $languageNames = Language::getLanguageNames(); - if ( !isset( $wgLanguageNames[$lang] ) ) { + if ( !isset( $languageNames[$lang] ) ) { $this->error( "Language $lang not found in \$wgLanguageNames", true ); } - $name = $wgLanguageNames[$lang]; + $name = $languageNames[$lang]; $dbw = wfGetDB( DB_MASTER ); $common = "/home/wikipedia/common"; @@ -80,13 +83,14 @@ class AddWiki extends Maintenance { $dbw->sourceFile( "$IP/extensions/UsabilityInitiative/ClickTracking/ClickTrackingEvents.sql" ); $dbw->sourceFile( "$IP/extensions/UsabilityInitiative/ClickTracking/ClickTracking.sql" ); $dbw->sourceFile( "$IP/extensions/UsabilityInitiative/UserDailyContribs/UserDailyContribs.sql" ); + $dbw->sourceFile( "$IP/extensions/UsabilityInitiative/OptIn/OptIn.sql" ); $dbw->query( "INSERT INTO site_stats(ss_row_id) VALUES (1)" ); # Initialise external storage if ( is_array( $wgDefaultExternalStore ) ) { $stores = $wgDefaultExternalStore; - } elseif ( $stores ) { + } elseif ( $wgDefaultExternalStore ) { $stores = array( $wgDefaultExternalStore ); } else { $stores = array(); @@ -138,11 +142,21 @@ class AddWiki extends Maintenance { fclose( $file ); # Update the sublists - shell_exec("cd $common && ./refresh-dblist"); + shell_exec( "cd $common && ./refresh-dblist" ); - #print "Constructing interwiki SQL\n"; + # print "Constructing interwiki SQL\n"; # Rebuild interwiki tables - #passthru( '/home/wikipedia/conf/interwiki/update' ); + # passthru( '/home/wikipedia/conf/interwiki/update' ); + + $time = wfTimestamp( TS_RFC2822 ); + // These arguments need to be escaped twice: once for echo and once for at + $escDbName = wfEscapeShellArg( wfEscapeShellArg( $dbName ) ); + $escTime = wfEscapeShellArg( wfEscapeShellArg( $time ) ); + $escUcsite = wfEscapeShellArg( wfEscapeShellArg( $ucsite ) ); + $escName = wfEscapeShellArg( wfEscapeShellArg( $name ) ); + $escLang = wfEscapeShellArg( wfEscapeShellArg( $lang ) ); + $escDomain = wfEscapeShellArg( wfEscapeShellArg( $domain ) ); + shell_exec( "echo notifyNewProjects $escDbName $escTime $escUcsite $escName $escLang $escDomain | at now + 15 minutes" ); $this->output( "Script ended. You still have to: * Add any required settings in InitialiseSettings.php @@ -150,7 +164,7 @@ class AddWiki extends Maintenance { * Run /home/wikipedia/conf/interwiki/update " ); } - + private function getFirstArticle( $ucsite, $name ) { return <<