followup r91869: validate id chars for incoming prefs tabs in hash ([\w-]+ is suffici...
[mediawiki.git] / maintenance / ourusers.php
blobc8578e24e905a52c94450d98be5a2f0c90bf5d5a
1 <?php
2 /**
3 * Wikimedia specific
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.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * http://www.gnu.org/copyleft/gpl.html
24 * @todo document
25 * @file
26 * @ingroup Maintenance
27 * @ingroup Wikimedia
30 /** */
31 $wikiuser_pass = `wikiuser_pass`;
32 $wikiadmin_pass = `wikiadmin_pass`;
33 $nagios_pass = `nagios_sql_pass`;
35 $hosts = array(
36 'localhost',
37 '10.0.%',
38 '66.230.200.%',
39 '208.80.152.%',
42 $databases = array(
43 '%wik%',
44 'centralauth',
47 print "/*!40100 set old_passwords=1 */;\n";
48 print "/*!40100 set global old_passwords=1 */;\n";
50 foreach ( $hosts as $host ) {
51 print "--\n-- $host\n--\n";
52 print "\n-- wikiuser\n\n";
53 print "GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
54 print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
55 foreach ( $databases as $db ) {
56 print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
59 print "\n-- wikiadmin\n\n";
60 print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
61 print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
62 foreach ( $databases as $db ) {
63 print "GRANT ALL PRIVILEGES ON `$db`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
65 print "\n-- nagios\n\n";
66 print "GRANT REPLICATION CLIENT ON *.* TO 'nagios'@'$host' IDENTIFIED BY '$nagios_pass';\n";
68 print "\n";