r69546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69545‎ | r69546 | r69547 >
Date:14:00, 19 July 2010
Author:catrope
Status:ok
Tags:
Comment:
(bug 24398) Make addwiki.php send a notification e-mail to newprojects@lists.wikimedia.org . Needs addition of fourth parameter for domain name, will document at wikitechwiki
Modified paths:
  • /trunk/phase3/maintenance/addwiki.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/addwiki.php
@@ -33,9 +33,10 @@
3434 public function __construct() {
3535 parent::__construct();
3636 $this->mDescription = "Add a new wiki to the family. Wikimedia specific!";
37 - $this->addArg( 'language', 'Language code of new site' );
38 - $this->addArg( 'site', 'Type of site' );
39 - $this->addArg( 'dbname', 'Name of database to create' );
 37+ $this->addArg( 'language', 'Language code of new site, e.g. en' );
 38+ $this->addArg( 'site', 'Type of site, e.g. wikipedia' );
 39+ $this->addArg( 'dbname', 'Name of database to create, e.g. enwiki' );
 40+ $this->addArg( 'domain', 'Domain name of the wiki, e.g. en.wikipedia.org' );
4041 }
4142
4243 public function getDbType() {
@@ -43,12 +44,13 @@
4445 }
4546
4647 public function execute() {
47 - global $IP, $wgDefaultExternalStore, $wgNoDBParam;
 48+ global $IP, $wgDefaultExternalStore, $wgNoDBParam, $wgPasswordSender;
4849
4950 $wgNoDBParam = true;
5051 $lang = $this->getArg( 0 );
5152 $site = $this->getArg( 1 );
5253 $dbName = $this->getArg( 2 );
 54+ $domain = $this->getArg( 3 );
5355 $languageNames = Language::getLanguageNames();
5456
5557 if ( !isset( $languageNames[$lang] ) ) {
@@ -146,6 +148,16 @@
147149 # print "Constructing interwiki SQL\n";
148150 # Rebuild interwiki tables
149151 # passthru( '/home/wikipedia/conf/interwiki/update' );
 152+
 153+ $user = getenv( 'USER' );
 154+ $time = wfTimestamp( TS_RFC2822 );
 155+ UserMailer::send( new MailAddress( 'newprojects@list.wikimedia.org' ),
 156+ new MailAddress( $wgPasswordSender ), "New wiki: $dbName",
 157+ <<<EOT
 158+A new wiki was created by $user at $time for a $ucsite in $name ($lang).
 159+Once the wiki is fully set up, it'll be visible at http://$domain
 160+EOT;
 161+ );
150162
151163 $this->output( "Script ended. You still have to:
152164 * Add any required settings in InitialiseSettings.php

Follow-up revisions

RevisionCommit summaryAuthorDate
r69553Followup to r69546: defer sending of notification by 15 minutescatrope15:13, 19 July 2010
r696191.16wmf4: Merge addwiki.php tweaks from trunk: r69546, r69553, r69554, r69608...catrope15:04, 20 July 2010

Status & tagging log