(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

This commit is contained in:
Roan Kattouw 2010-07-19 14:00:51 +00:00
parent 9329e10190
commit 84310e2fc8

View file

@ -33,9 +33,10 @@ 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,12 +44,13 @@ class AddWiki extends Maintenance {
}
public function execute() {
global $IP, $wgDefaultExternalStore, $wgNoDBParam;
global $IP, $wgDefaultExternalStore, $wgNoDBParam, $wgPasswordSender;
$wgNoDBParam = true;
$lang = $this->getArg( 0 );
$site = $this->getArg( 1 );
$dbName = $this->getArg( 2 );
$domain = $this->getArg( 3 );
$languageNames = Language::getLanguageNames();
if ( !isset( $languageNames[$lang] ) ) {
@ -146,6 +148,16 @@ class AddWiki extends Maintenance {
# print "Constructing interwiki SQL\n";
# Rebuild interwiki tables
# passthru( '/home/wikipedia/conf/interwiki/update' );
$user = getenv( 'USER' );
$time = wfTimestamp( TS_RFC2822 );
UserMailer::send( new MailAddress( 'newprojects@list.wikimedia.org' ),
new MailAddress( $wgPasswordSender ), "New wiki: $dbName",
<<<EOT
A new wiki was created by $user at $time for a $ucsite in $name ($lang).
Once the wiki is fully set up, it'll be visible at http://$domain
EOT;
);
$this->output( "Script ended. You still have to:
* Add any required settings in InitialiseSettings.php