summaryrefslogtreecommitdiff
path: root/maintenance/addwiki.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/addwiki.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'maintenance/addwiki.php')
-rw-r--r--maintenance/addwiki.php46
1 files changed, 30 insertions, 16 deletions
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 <<<EOT
==This subdomain is reserved for the creation of a [[wikimedia:Our projects|$ucsite]] in '''[[w:en:{$name}|{$name}]]''' language==
@@ -451,4 +465,4 @@ EOT;
}
$maintClass = "AddWiki";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );