Index: trunk/extensions/WikimediaMaintenance/addwiki.php |
— | — | @@ -1,211 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * @defgroup Wikimedia Wikimedia |
5 | | - */ |
6 | | - |
7 | | -/** |
8 | | - * Add a new wiki |
9 | | - * Wikimedia specific! |
10 | | - * |
11 | | - * This program is free software; you can redistribute it and/or modify |
12 | | - * it under the terms of the GNU General Public License as published by |
13 | | - * the Free Software Foundation; either version 2 of the License, or |
14 | | - * (at your option) any later version. |
15 | | - * |
16 | | - * This program is distributed in the hope that it will be useful, |
17 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | | - * GNU General Public License for more details. |
20 | | - * |
21 | | - * You should have received a copy of the GNU General Public License along |
22 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
23 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 | | - * http://www.gnu.org/copyleft/gpl.html |
25 | | - * |
26 | | - * @file |
27 | | - * @ingroup Maintenance |
28 | | - * @ingroup Wikimedia |
29 | | - */ |
30 | | - |
31 | | -$IP = getenv( 'MW_INSTALL_PATH' ); |
32 | | -if ( $IP === false ) { |
33 | | - $IP = dirname( __FILE__ ) . '/../..'; |
34 | | -} |
35 | | -require( "$IP/maintenance/Maintenance.php" ); |
36 | | - |
37 | | -class AddWiki extends Maintenance { |
38 | | - public function __construct() { |
39 | | - global $wgNoDBParam; |
40 | | - |
41 | | - parent::__construct(); |
42 | | - $this->mDescription = "Add a new wiki to the family. Wikimedia specific!"; |
43 | | - $this->addArg( 'language', 'Language code of new site, e.g. en' ); |
44 | | - $this->addArg( 'site', 'Type of site, e.g. wikipedia' ); |
45 | | - $this->addArg( 'dbname', 'Name of database to create, e.g. enwiki' ); |
46 | | - $this->addArg( 'domain', 'Domain name of the wiki, e.g. en.wikipedia.org' ); |
47 | | - |
48 | | - $wgNoDBParam = true; |
49 | | - } |
50 | | - |
51 | | - public function getDbType() { |
52 | | - return Maintenance::DB_ADMIN; |
53 | | - } |
54 | | - |
55 | | - public function execute() { |
56 | | - global $IP, $wgDefaultExternalStore, $wmfVersionNumber; |
57 | | - if ( !$wmfVersionNumber ) { // set in CommonSettings.php |
58 | | - $this->error( '$wmfVersionNumber is not set, please use MWScript.php wrapper.', true ); |
59 | | - } |
60 | | - |
61 | | - $lang = $this->getArg( 0 ); |
62 | | - $site = $this->getArg( 1 ); |
63 | | - $dbName = $this->getArg( 2 ); |
64 | | - $domain = $this->getArg( 3 ); |
65 | | - $languageNames = Language::getLanguageNames(); |
66 | | - |
67 | | - if ( !isset( $languageNames[$lang] ) ) { |
68 | | - $this->error( "Language $lang not found in Names.php", true ); |
69 | | - } |
70 | | - $name = $languageNames[$lang]; |
71 | | - |
72 | | - $dbw = wfGetDB( DB_MASTER ); |
73 | | - $common = "/home/wikipedia/common"; |
74 | | - |
75 | | - $this->output( "Creating database $dbName for $lang.$site ($name)\n" ); |
76 | | - |
77 | | - # Set up the database |
78 | | - $dbw->query( "SET table_type=Innodb" ); |
79 | | - $dbw->query( "CREATE DATABASE $dbName" ); |
80 | | - $dbw->selectDB( $dbName ); |
81 | | - |
82 | | - $this->output( "Initialising tables\n" ); |
83 | | - $dbw->sourceFile( $this->getDir() . '/tables.sql' ); |
84 | | - $dbw->sourceFile( "$IP/extensions/OAI/update_table.sql" ); |
85 | | - $dbw->sourceFile( "$IP/extensions/AntiSpoof/sql/patch-antispoof.mysql.sql" ); |
86 | | - $dbw->sourceFile( "$IP/extensions/CheckUser/cu_changes.sql" ); |
87 | | - $dbw->sourceFile( "$IP/extensions/CheckUser/cu_log.sql" ); |
88 | | - $dbw->sourceFile( "$IP/extensions/TitleKey/titlekey.sql" ); |
89 | | - $dbw->sourceFile( "$IP/extensions/Oversight/hidden.sql" ); |
90 | | - $dbw->sourceFile( "$IP/extensions/GlobalBlocking/localdb_patches/setup-global_block_whitelist.sql" ); |
91 | | - $dbw->sourceFile( "$IP/extensions/AbuseFilter/abusefilter.tables.sql" ); |
92 | | - $dbw->sourceFile( "$IP/extensions/PrefStats/patches/PrefStats.sql" ); |
93 | | - $dbw->sourceFile( "$IP/extensions/ProofreadPage/ProofreadPage.sql" ); |
94 | | - $dbw->sourceFile( "$IP/extensions/ClickTracking/patches/ClickTrackingEvents.sql" ); |
95 | | - $dbw->sourceFile( "$IP/extensions/ClickTracking/patches/ClickTracking.sql" ); |
96 | | - $dbw->sourceFile( "$IP/extensions/UserDailyContribs/patches/UserDailyContribs.sql" ); |
97 | | - |
98 | | - $dbw->query( "INSERT INTO site_stats(ss_row_id) VALUES (1)" ); |
99 | | - |
100 | | - # Initialise external storage |
101 | | - if ( is_array( $wgDefaultExternalStore ) ) { |
102 | | - $stores = $wgDefaultExternalStore; |
103 | | - } elseif ( $wgDefaultExternalStore ) { |
104 | | - $stores = array( $wgDefaultExternalStore ); |
105 | | - } else { |
106 | | - $stores = array(); |
107 | | - } |
108 | | - if ( count( $stores ) ) { |
109 | | - global $wgDBuser, $wgDBpassword, $wgExternalServers; |
110 | | - foreach ( $stores as $storeURL ) { |
111 | | - $m = array(); |
112 | | - if ( !preg_match( '!^DB://(.*)$!', $storeURL, $m ) ) { |
113 | | - continue; |
114 | | - } |
115 | | - |
116 | | - $cluster = $m[1]; |
117 | | - $this->output( "Initialising external storage $cluster...\n" ); |
118 | | - |
119 | | - # Hack |
120 | | - $wgExternalServers[$cluster][0]['user'] = $wgDBuser; |
121 | | - $wgExternalServers[$cluster][0]['password'] = $wgDBpassword; |
122 | | - |
123 | | - $store = new ExternalStoreDB; |
124 | | - $extdb = $store->getMaster( $cluster ); |
125 | | - $extdb->query( "SET table_type=InnoDB" ); |
126 | | - $extdb->query( "CREATE DATABASE $dbName" ); |
127 | | - $extdb->selectDB( $dbName ); |
128 | | - |
129 | | - # Hack x2 |
130 | | - $blobsTable = $store->getTable( $extdb ); |
131 | | - $sedCmd = "sed s/blobs\\\\\\>/$blobsTable/ " . $this->getDir() . "/storage/blobs.sql"; |
132 | | - $blobsFile = popen( $sedCmd, 'r' ); |
133 | | - $extdb->sourceStream( $blobsFile ); |
134 | | - pclose( $blobsFile ); |
135 | | - $extdb->commit(); |
136 | | - } |
137 | | - } |
138 | | - |
139 | | - $title = Title::newFromText( wfMessage( 'mainpage' )->inLanguage( $lang )->useDatabase( false )->plain() ); |
140 | | - $this->output( "Writing main page to " . $title->getPrefixedDBkey() . "\n" ); |
141 | | - $article = new Article( $title ); |
142 | | - $ucsite = ucfirst( $site ); |
143 | | - |
144 | | - $article->doEdit( $this->getFirstArticle( $ucsite, $name ), '', EDIT_NEW | EDIT_AUTOSUMMARY ); |
145 | | - |
146 | | - $this->output( "Adding to dblists\n" ); |
147 | | - |
148 | | - # Add to dblist |
149 | | - $file = fopen( "$common/all.dblist", "a" ); |
150 | | - fwrite( $file, "$dbName\n" ); |
151 | | - fclose( $file ); |
152 | | - |
153 | | - # Update the sublists |
154 | | - shell_exec( "cd $common && ./refresh-dblist" ); |
155 | | - |
156 | | - # Add to wikiversions.dat |
157 | | - $file = fopen( "$common/wikiversions.dat", "a" ); |
158 | | - fwrite( $file, "$dbName php-$wmfVersionNumber\n" ); |
159 | | - fclose( $file ); |
160 | | - # Rebuild wikiversions.cdb |
161 | | - shell_exec( "cd $common/multiversion && ./refreshWikiversionsCDB" ); |
162 | | - |
163 | | - # print "Constructing interwiki SQL\n"; |
164 | | - # Rebuild interwiki tables |
165 | | - # passthru( '/home/wikipedia/conf/interwiki/update' ); |
166 | | - |
167 | | - $time = wfTimestamp( TS_RFC2822 ); |
168 | | - // These arguments need to be escaped twice: once for echo and once for at |
169 | | - $escDbName = wfEscapeShellArg( wfEscapeShellArg( $dbName ) ); |
170 | | - $escTime = wfEscapeShellArg( wfEscapeShellArg( $time ) ); |
171 | | - $escUcsite = wfEscapeShellArg( wfEscapeShellArg( $ucsite ) ); |
172 | | - $escName = wfEscapeShellArg( wfEscapeShellArg( $name ) ); |
173 | | - $escLang = wfEscapeShellArg( wfEscapeShellArg( $lang ) ); |
174 | | - $escDomain = wfEscapeShellArg( wfEscapeShellArg( $domain ) ); |
175 | | - shell_exec( "echo notifyNewProjects $escDbName $escTime $escUcsite $escName $escLang $escDomain | at now + 15 minutes" ); |
176 | | - |
177 | | - $this->output( "Script ended. You still have to: |
178 | | - * Add any required settings in InitialiseSettings.php |
179 | | - * Run sync-common-all |
180 | | - * Run /home/wikipedia/conf/interwiki/update |
181 | | - " ); |
182 | | - } |
183 | | - |
184 | | - private function getFirstArticle( $ucsite, $name ) { |
185 | | - return <<<EOT |
186 | | -==This subdomain is reserved for the creation of a [[wikimedia:Our projects|$ucsite]] in '''[[w:en:{$name}|{$name}]]''' language== |
187 | | - |
188 | | -* Please '''do not start editing''' this new site. This site has a test project on the [[incubator:|Wikimedia Incubator]] (or on the [[betawikiversity:|Beta Wikiversity]] or on the [[oldwikisource:|Old Wikisource]]) and it will be imported to here. |
189 | | - |
190 | | -* If you would like to help translating the interface to this language, please do not translate here, but go to [[translatewiki:|translatewiki.net]], a special wiki for translating the interface. That way everyone can use it on every wiki using the [[mw:|same software]]. |
191 | | - |
192 | | -* For information about how to edit and for other general help, see [[m:Help:Contents|Help on Wikimedia's Meta-Wiki]] or [[mw:Help:Contents|Help on MediaWiki.org]]. |
193 | | - |
194 | | -== Sister projects == |
195 | | -<span class="plainlinks"> |
196 | | -[http://www.wikipedia.org Wikipedia] | |
197 | | -[http://www.wiktionary.org Wiktionary] | |
198 | | -[http://www.wikibooks.org Wikibooks] | |
199 | | -[http://www.wikinews.org Wikinews] | |
200 | | -[http://www.wikiquote.org Wikiquote] | |
201 | | -[http://www.wikisource.org Wikisource] | |
202 | | -[http://www.wikiversity.org Wikiversity] |
203 | | -</span> |
204 | | - |
205 | | -See Wikimedia's [[m:|Meta-Wiki]] for the coordination of these projects. |
206 | | - |
207 | | -EOT; |
208 | | - } |
209 | | -} |
210 | | - |
211 | | -$maintClass = "AddWiki"; |
212 | | -require_once( RUN_MAINTENANCE_IF_MAIN ); |
Index: trunk/extensions/WikimediaMaintenance/ourusers.php |
— | — | @@ -1,70 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * Wikimedia specific |
5 | | - * |
6 | | - * This script generates SQL used to update MySQL users on a hardcoded |
7 | | - * list of hosts. It takes care of setting the wikiuser for every |
8 | | - * database as well as setting up wikiadmin. |
9 | | - * |
10 | | - * This program is free software; you can redistribute it and/or modify |
11 | | - * it under the terms of the GNU General Public License as published by |
12 | | - * the Free Software Foundation; either version 2 of the License, or |
13 | | - * (at your option) any later version. |
14 | | - * |
15 | | - * This program is distributed in the hope that it will be useful, |
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | | - * GNU General Public License for more details. |
19 | | - * |
20 | | - * You should have received a copy of the GNU General Public License along |
21 | | - * with this program; if not, write to the Free Software Foundation, Inc., |
22 | | - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 | | - * http://www.gnu.org/copyleft/gpl.html |
24 | | - * |
25 | | - * @todo document |
26 | | - * @file |
27 | | - * @ingroup Maintenance |
28 | | - * @ingroup Wikimedia |
29 | | - */ |
30 | | - |
31 | | -/** */ |
32 | | -$wikiuser_pass = `wikiuser_pass`; |
33 | | -$wikiadmin_pass = `wikiadmin_pass`; |
34 | | -$nagios_pass = `nagios_sql_pass`; |
35 | | - |
36 | | -$hosts = array( |
37 | | - 'localhost', |
38 | | - '10.0.%', |
39 | | - '66.230.200.%', |
40 | | - '208.80.152.%', |
41 | | -); |
42 | | - |
43 | | -$databases = array( |
44 | | - '%wik%', |
45 | | - 'centralauth', |
46 | | -); |
47 | | - |
48 | | -print "/*!40100 set old_passwords=1 */;\n"; |
49 | | -print "/*!40100 set global old_passwords=1 */;\n"; |
50 | | - |
51 | | -foreach ( $hosts as $host ) { |
52 | | - print "--\n-- $host\n--\n"; |
53 | | - print "\n-- wikiuser\n\n"; |
54 | | - print "GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n"; |
55 | | - print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n"; |
56 | | - foreach ( $databases as $db ) { |
57 | | - print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n"; |
58 | | - } |
59 | | - |
60 | | - print "\n-- wikiadmin\n\n"; |
61 | | - print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n"; |
62 | | - print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n"; |
63 | | - foreach ( $databases as $db ) { |
64 | | - print "GRANT ALL PRIVILEGES ON `$db`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n"; |
65 | | - } |
66 | | - print "\n-- nagios\n\n"; |
67 | | - print "GRANT REPLICATION CLIENT ON *.* TO 'nagios'@'$host' IDENTIFIED BY '$nagios_pass';\n"; |
68 | | - |
69 | | - print "\n"; |
70 | | -} |
71 | | - |
Index: trunk/extensions/WikimediaMaintenance/addWiki.php |
— | — | @@ -0,0 +1,211 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @defgroup Wikimedia Wikimedia |
| 5 | + */ |
| 6 | + |
| 7 | +/** |
| 8 | + * Add a new wiki |
| 9 | + * Wikimedia specific! |
| 10 | + * |
| 11 | + * This program is free software; you can redistribute it and/or modify |
| 12 | + * it under the terms of the GNU General Public License as published by |
| 13 | + * the Free Software Foundation; either version 2 of the License, or |
| 14 | + * (at your option) any later version. |
| 15 | + * |
| 16 | + * This program is distributed in the hope that it will be useful, |
| 17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | + * GNU General Public License for more details. |
| 20 | + * |
| 21 | + * You should have received a copy of the GNU General Public License along |
| 22 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 23 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 24 | + * http://www.gnu.org/copyleft/gpl.html |
| 25 | + * |
| 26 | + * @file |
| 27 | + * @ingroup Maintenance |
| 28 | + * @ingroup Wikimedia |
| 29 | + */ |
| 30 | + |
| 31 | +$IP = getenv( 'MW_INSTALL_PATH' ); |
| 32 | +if ( $IP === false ) { |
| 33 | + $IP = dirname( __FILE__ ) . '/../..'; |
| 34 | +} |
| 35 | +require( "$IP/maintenance/Maintenance.php" ); |
| 36 | + |
| 37 | +class AddWiki extends Maintenance { |
| 38 | + public function __construct() { |
| 39 | + global $wgNoDBParam; |
| 40 | + |
| 41 | + parent::__construct(); |
| 42 | + $this->mDescription = "Add a new wiki to the family. Wikimedia specific!"; |
| 43 | + $this->addArg( 'language', 'Language code of new site, e.g. en' ); |
| 44 | + $this->addArg( 'site', 'Type of site, e.g. wikipedia' ); |
| 45 | + $this->addArg( 'dbname', 'Name of database to create, e.g. enwiki' ); |
| 46 | + $this->addArg( 'domain', 'Domain name of the wiki, e.g. en.wikipedia.org' ); |
| 47 | + |
| 48 | + $wgNoDBParam = true; |
| 49 | + } |
| 50 | + |
| 51 | + public function getDbType() { |
| 52 | + return Maintenance::DB_ADMIN; |
| 53 | + } |
| 54 | + |
| 55 | + public function execute() { |
| 56 | + global $IP, $wgDefaultExternalStore, $wmfVersionNumber; |
| 57 | + if ( !$wmfVersionNumber ) { // set in CommonSettings.php |
| 58 | + $this->error( '$wmfVersionNumber is not set, please use MWScript.php wrapper.', true ); |
| 59 | + } |
| 60 | + |
| 61 | + $lang = $this->getArg( 0 ); |
| 62 | + $site = $this->getArg( 1 ); |
| 63 | + $dbName = $this->getArg( 2 ); |
| 64 | + $domain = $this->getArg( 3 ); |
| 65 | + $languageNames = Language::getLanguageNames(); |
| 66 | + |
| 67 | + if ( !isset( $languageNames[$lang] ) ) { |
| 68 | + $this->error( "Language $lang not found in Names.php", true ); |
| 69 | + } |
| 70 | + $name = $languageNames[$lang]; |
| 71 | + |
| 72 | + $dbw = wfGetDB( DB_MASTER ); |
| 73 | + $common = "/home/wikipedia/common"; |
| 74 | + |
| 75 | + $this->output( "Creating database $dbName for $lang.$site ($name)\n" ); |
| 76 | + |
| 77 | + # Set up the database |
| 78 | + $dbw->query( "SET table_type=Innodb" ); |
| 79 | + $dbw->query( "CREATE DATABASE $dbName" ); |
| 80 | + $dbw->selectDB( $dbName ); |
| 81 | + |
| 82 | + $this->output( "Initialising tables\n" ); |
| 83 | + $dbw->sourceFile( $this->getDir() . '/tables.sql' ); |
| 84 | + $dbw->sourceFile( "$IP/extensions/OAI/update_table.sql" ); |
| 85 | + $dbw->sourceFile( "$IP/extensions/AntiSpoof/sql/patch-antispoof.mysql.sql" ); |
| 86 | + $dbw->sourceFile( "$IP/extensions/CheckUser/cu_changes.sql" ); |
| 87 | + $dbw->sourceFile( "$IP/extensions/CheckUser/cu_log.sql" ); |
| 88 | + $dbw->sourceFile( "$IP/extensions/TitleKey/titlekey.sql" ); |
| 89 | + $dbw->sourceFile( "$IP/extensions/Oversight/hidden.sql" ); |
| 90 | + $dbw->sourceFile( "$IP/extensions/GlobalBlocking/localdb_patches/setup-global_block_whitelist.sql" ); |
| 91 | + $dbw->sourceFile( "$IP/extensions/AbuseFilter/abusefilter.tables.sql" ); |
| 92 | + $dbw->sourceFile( "$IP/extensions/PrefStats/patches/PrefStats.sql" ); |
| 93 | + $dbw->sourceFile( "$IP/extensions/ProofreadPage/ProofreadPage.sql" ); |
| 94 | + $dbw->sourceFile( "$IP/extensions/ClickTracking/patches/ClickTrackingEvents.sql" ); |
| 95 | + $dbw->sourceFile( "$IP/extensions/ClickTracking/patches/ClickTracking.sql" ); |
| 96 | + $dbw->sourceFile( "$IP/extensions/UserDailyContribs/patches/UserDailyContribs.sql" ); |
| 97 | + |
| 98 | + $dbw->query( "INSERT INTO site_stats(ss_row_id) VALUES (1)" ); |
| 99 | + |
| 100 | + # Initialise external storage |
| 101 | + if ( is_array( $wgDefaultExternalStore ) ) { |
| 102 | + $stores = $wgDefaultExternalStore; |
| 103 | + } elseif ( $wgDefaultExternalStore ) { |
| 104 | + $stores = array( $wgDefaultExternalStore ); |
| 105 | + } else { |
| 106 | + $stores = array(); |
| 107 | + } |
| 108 | + if ( count( $stores ) ) { |
| 109 | + global $wgDBuser, $wgDBpassword, $wgExternalServers; |
| 110 | + foreach ( $stores as $storeURL ) { |
| 111 | + $m = array(); |
| 112 | + if ( !preg_match( '!^DB://(.*)$!', $storeURL, $m ) ) { |
| 113 | + continue; |
| 114 | + } |
| 115 | + |
| 116 | + $cluster = $m[1]; |
| 117 | + $this->output( "Initialising external storage $cluster...\n" ); |
| 118 | + |
| 119 | + # Hack |
| 120 | + $wgExternalServers[$cluster][0]['user'] = $wgDBuser; |
| 121 | + $wgExternalServers[$cluster][0]['password'] = $wgDBpassword; |
| 122 | + |
| 123 | + $store = new ExternalStoreDB; |
| 124 | + $extdb = $store->getMaster( $cluster ); |
| 125 | + $extdb->query( "SET table_type=InnoDB" ); |
| 126 | + $extdb->query( "CREATE DATABASE $dbName" ); |
| 127 | + $extdb->selectDB( $dbName ); |
| 128 | + |
| 129 | + # Hack x2 |
| 130 | + $blobsTable = $store->getTable( $extdb ); |
| 131 | + $sedCmd = "sed s/blobs\\\\\\>/$blobsTable/ " . $this->getDir() . "/storage/blobs.sql"; |
| 132 | + $blobsFile = popen( $sedCmd, 'r' ); |
| 133 | + $extdb->sourceStream( $blobsFile ); |
| 134 | + pclose( $blobsFile ); |
| 135 | + $extdb->commit(); |
| 136 | + } |
| 137 | + } |
| 138 | + |
| 139 | + $title = Title::newFromText( wfMessage( 'mainpage' )->inLanguage( $lang )->useDatabase( false )->plain() ); |
| 140 | + $this->output( "Writing main page to " . $title->getPrefixedDBkey() . "\n" ); |
| 141 | + $article = new Article( $title ); |
| 142 | + $ucsite = ucfirst( $site ); |
| 143 | + |
| 144 | + $article->doEdit( $this->getFirstArticle( $ucsite, $name ), '', EDIT_NEW | EDIT_AUTOSUMMARY ); |
| 145 | + |
| 146 | + $this->output( "Adding to dblists\n" ); |
| 147 | + |
| 148 | + # Add to dblist |
| 149 | + $file = fopen( "$common/all.dblist", "a" ); |
| 150 | + fwrite( $file, "$dbName\n" ); |
| 151 | + fclose( $file ); |
| 152 | + |
| 153 | + # Update the sublists |
| 154 | + shell_exec( "cd $common && ./refresh-dblist" ); |
| 155 | + |
| 156 | + # Add to wikiversions.dat |
| 157 | + $file = fopen( "$common/wikiversions.dat", "a" ); |
| 158 | + fwrite( $file, "$dbName php-$wmfVersionNumber\n" ); |
| 159 | + fclose( $file ); |
| 160 | + # Rebuild wikiversions.cdb |
| 161 | + shell_exec( "cd $common/multiversion && ./refreshWikiversionsCDB" ); |
| 162 | + |
| 163 | + # print "Constructing interwiki SQL\n"; |
| 164 | + # Rebuild interwiki tables |
| 165 | + # passthru( '/home/wikipedia/conf/interwiki/update' ); |
| 166 | + |
| 167 | + $time = wfTimestamp( TS_RFC2822 ); |
| 168 | + // These arguments need to be escaped twice: once for echo and once for at |
| 169 | + $escDbName = wfEscapeShellArg( wfEscapeShellArg( $dbName ) ); |
| 170 | + $escTime = wfEscapeShellArg( wfEscapeShellArg( $time ) ); |
| 171 | + $escUcsite = wfEscapeShellArg( wfEscapeShellArg( $ucsite ) ); |
| 172 | + $escName = wfEscapeShellArg( wfEscapeShellArg( $name ) ); |
| 173 | + $escLang = wfEscapeShellArg( wfEscapeShellArg( $lang ) ); |
| 174 | + $escDomain = wfEscapeShellArg( wfEscapeShellArg( $domain ) ); |
| 175 | + shell_exec( "echo notifyNewProjects $escDbName $escTime $escUcsite $escName $escLang $escDomain | at now + 15 minutes" ); |
| 176 | + |
| 177 | + $this->output( "Script ended. You still have to: |
| 178 | + * Add any required settings in InitialiseSettings.php |
| 179 | + * Run sync-common-all |
| 180 | + * Run /home/wikipedia/conf/interwiki/update |
| 181 | + " ); |
| 182 | + } |
| 183 | + |
| 184 | + private function getFirstArticle( $ucsite, $name ) { |
| 185 | + return <<<EOT |
| 186 | +==This subdomain is reserved for the creation of a [[wikimedia:Our projects|$ucsite]] in '''[[w:en:{$name}|{$name}]]''' language== |
| 187 | + |
| 188 | +* Please '''do not start editing''' this new site. This site has a test project on the [[incubator:|Wikimedia Incubator]] (or on the [[betawikiversity:|Beta Wikiversity]] or on the [[oldwikisource:|Old Wikisource]]) and it will be imported to here. |
| 189 | + |
| 190 | +* If you would like to help translating the interface to this language, please do not translate here, but go to [[translatewiki:|translatewiki.net]], a special wiki for translating the interface. That way everyone can use it on every wiki using the [[mw:|same software]]. |
| 191 | + |
| 192 | +* For information about how to edit and for other general help, see [[m:Help:Contents|Help on Wikimedia's Meta-Wiki]] or [[mw:Help:Contents|Help on MediaWiki.org]]. |
| 193 | + |
| 194 | +== Sister projects == |
| 195 | +<span class="plainlinks"> |
| 196 | +[http://www.wikipedia.org Wikipedia] | |
| 197 | +[http://www.wiktionary.org Wiktionary] | |
| 198 | +[http://www.wikibooks.org Wikibooks] | |
| 199 | +[http://www.wikinews.org Wikinews] | |
| 200 | +[http://www.wikiquote.org Wikiquote] | |
| 201 | +[http://www.wikisource.org Wikisource] | |
| 202 | +[http://www.wikiversity.org Wikiversity] |
| 203 | +</span> |
| 204 | + |
| 205 | +See Wikimedia's [[m:|Meta-Wiki]] for the coordination of these projects. |
| 206 | + |
| 207 | +EOT; |
| 208 | + } |
| 209 | +} |
| 210 | + |
| 211 | +$maintClass = "AddWiki"; |
| 212 | +require_once( RUN_MAINTENANCE_IF_MAIN ); |
Property changes on: trunk/extensions/WikimediaMaintenance/addWiki.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 213 | + native |
Added: svn:keywords |
2 | 214 | + Author Date Id Revision |
Index: trunk/extensions/WikimediaMaintenance/ourUsers.php |
— | — | @@ -0,0 +1,70 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Wikimedia specific |
| 5 | + * |
| 6 | + * This script generates SQL used to update MySQL users on a hardcoded |
| 7 | + * list of hosts. It takes care of setting the wikiuser for every |
| 8 | + * database as well as setting up wikiadmin. |
| 9 | + * |
| 10 | + * This program is free software; you can redistribute it and/or modify |
| 11 | + * it under the terms of the GNU General Public License as published by |
| 12 | + * the Free Software Foundation; either version 2 of the License, or |
| 13 | + * (at your option) any later version. |
| 14 | + * |
| 15 | + * This program is distributed in the hope that it will be useful, |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + * GNU General Public License for more details. |
| 19 | + * |
| 20 | + * You should have received a copy of the GNU General Public License along |
| 21 | + * with this program; if not, write to the Free Software Foundation, Inc., |
| 22 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 23 | + * http://www.gnu.org/copyleft/gpl.html |
| 24 | + * |
| 25 | + * @todo document |
| 26 | + * @file |
| 27 | + * @ingroup Maintenance |
| 28 | + * @ingroup Wikimedia |
| 29 | + */ |
| 30 | + |
| 31 | +/** */ |
| 32 | +$wikiuser_pass = `wikiuser_pass`; |
| 33 | +$wikiadmin_pass = `wikiadmin_pass`; |
| 34 | +$nagios_pass = `nagios_sql_pass`; |
| 35 | + |
| 36 | +$hosts = array( |
| 37 | + 'localhost', |
| 38 | + '10.0.%', |
| 39 | + '66.230.200.%', |
| 40 | + '208.80.152.%', |
| 41 | +); |
| 42 | + |
| 43 | +$databases = array( |
| 44 | + '%wik%', |
| 45 | + 'centralauth', |
| 46 | +); |
| 47 | + |
| 48 | +print "/*!40100 set old_passwords=1 */;\n"; |
| 49 | +print "/*!40100 set global old_passwords=1 */;\n"; |
| 50 | + |
| 51 | +foreach ( $hosts as $host ) { |
| 52 | + print "--\n-- $host\n--\n"; |
| 53 | + print "\n-- wikiuser\n\n"; |
| 54 | + print "GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n"; |
| 55 | + print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n"; |
| 56 | + foreach ( $databases as $db ) { |
| 57 | + print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n"; |
| 58 | + } |
| 59 | + |
| 60 | + print "\n-- wikiadmin\n\n"; |
| 61 | + print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n"; |
| 62 | + print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n"; |
| 63 | + foreach ( $databases as $db ) { |
| 64 | + print "GRANT ALL PRIVILEGES ON `$db`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n"; |
| 65 | + } |
| 66 | + print "\n-- nagios\n\n"; |
| 67 | + print "GRANT REPLICATION CLIENT ON *.* TO 'nagios'@'$host' IDENTIFIED BY '$nagios_pass';\n"; |
| 68 | + |
| 69 | + print "\n"; |
| 70 | +} |
| 71 | + |
Property changes on: trunk/extensions/WikimediaMaintenance/ourUsers.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 72 | + native |
Added: svn:keywords |
2 | 73 | + Author Date Id Revision |