Revert merge of DismissableSiteNotice into the core (r41679 and subsequent edits...
[lhc/web/wiklou.git] / maintenance / ourusers.php
1 <?php
2 /**
3 * Wikimedia specific
4 *
5 * This script generates SQL used to update MySQL users on a hardcoded
6 * list of hosts. It takes care of setting the wikiuser for every
7 * database as well as setting up wikiadmin.
8 *
9 * @todo document
10 * @file
11 * @ingroup Maintenance
12 */
13
14 /** */
15 $wikiuser_pass = `wikiuser_pass`;
16 $wikiadmin_pass = `wikiadmin_pass`;
17 $wikisql_pass = `wikisql_pass`;
18
19 if ( @$argv[1] == 'yaseo' ) {
20 $hosts = array(
21 'localhost',
22 '211.115.107.158',
23 '211.115.107.159',
24 '211.115.107.160',
25 '211.115.107.138',
26 '211.115.107.139',
27 '211.115.107.140',
28 '211.115.107.141',
29 '211.115.107.142',
30 '211.115.107.143',
31 '211.115.107.144',
32 '211.115.107.145',
33 '211.115.107.146',
34 '211.115.107.147',
35 '211.115.107.148',
36 '211.115.107.149',
37 '211.115.107.150',
38 '211.115.107.152',
39 '211.115.107.153',
40 '211.115.107.154',
41 '211.115.107.155',
42 '211.115.107.156',
43 '211.115.107.157',
44 );
45 } else {
46 $hosts = array(
47 'localhost',
48 '10.0.%',
49 '66.230.200.%',
50 '208.80.152.%',
51 );
52 }
53
54 $databases = array(
55 '%wik%',
56 'centralauth',
57 );
58
59 print "/*!40100 set old_passwords=1 */;\n";
60 print "/*!40100 set global old_passwords=1 */;\n";
61
62 foreach( $hosts as $host ) {
63 print "--\n-- $host\n--\n\n-- wikiuser\n\n";
64 print "GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
65 print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
66 foreach( $databases as $db ) {
67 print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
68 }
69
70 print "\n-- wikiadmin\n\n";
71 print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
72 print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
73 foreach ( $databases as $db ) {
74 print "GRANT ALL PRIVILEGES ON `$db`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
75 }
76 print "\n";
77 }
78