2004-07-27 13:17:08 +00:00
|
|
|
<?php
|
2004-09-03 20:33:01 +00:00
|
|
|
/**
|
2008-07-19 12:15:07 +00:00
|
|
|
* Wikimedia specific
|
|
|
|
|
*
|
|
|
|
|
* This script generates SQL used to update MySQL users on a hardcoded
|
|
|
|
|
* list of hosts. It takes care of setting the wikiuser for every
|
|
|
|
|
* database as well as setting up wikiadmin.
|
|
|
|
|
*
|
2010-12-16 19:15:12 +00:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
2004-09-03 20:33:01 +00:00
|
|
|
* @todo document
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @file
|
|
|
|
|
* @ingroup Maintenance
|
2009-08-05 00:34:18 +00:00
|
|
|
* @ingroup Wikimedia
|
2004-09-03 20:33:01 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** */
|
2004-07-27 13:17:08 +00:00
|
|
|
$wikiuser_pass = `wikiuser_pass`;
|
|
|
|
|
$wikiadmin_pass = `wikiadmin_pass`;
|
2008-10-24 15:17:57 +00:00
|
|
|
$nagios_pass = `nagios_sql_pass`;
|
2004-07-27 13:17:08 +00:00
|
|
|
|
2008-10-24 15:17:57 +00:00
|
|
|
$hosts = array(
|
|
|
|
|
'localhost',
|
|
|
|
|
'10.0.%',
|
|
|
|
|
'66.230.200.%',
|
|
|
|
|
'208.80.152.%',
|
|
|
|
|
);
|
2004-07-27 13:17:08 +00:00
|
|
|
|
|
|
|
|
$databases = array(
|
2006-08-21 09:32:33 +00:00
|
|
|
'%wik%',
|
2008-06-19 23:35:40 +00:00
|
|
|
'centralauth',
|
2004-07-27 13:17:08 +00:00
|
|
|
);
|
|
|
|
|
|
2008-06-19 23:35:40 +00:00
|
|
|
print "/*!40100 set old_passwords=1 */;\n";
|
|
|
|
|
print "/*!40100 set global old_passwords=1 */;\n";
|
2006-08-21 09:32:33 +00:00
|
|
|
|
2010-05-22 16:50:39 +00:00
|
|
|
foreach ( $hosts as $host ) {
|
2008-10-24 15:17:57 +00:00
|
|
|
print "--\n-- $host\n--\n";
|
|
|
|
|
print "\n-- wikiuser\n\n";
|
2005-06-19 01:44:13 +00:00
|
|
|
print "GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
|
2006-10-02 17:04:13 +00:00
|
|
|
print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
|
2010-05-22 16:50:39 +00:00
|
|
|
foreach ( $databases as $db ) {
|
2004-07-27 13:17:08 +00:00
|
|
|
print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
|
|
|
|
|
}
|
2006-01-07 13:31:29 +00:00
|
|
|
|
2004-07-27 13:17:08 +00:00
|
|
|
print "\n-- wikiadmin\n\n";
|
|
|
|
|
print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
|
2006-10-02 17:04:13 +00:00
|
|
|
print "GRANT ALL PRIVILEGES ON `boardvote%`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
|
2004-07-27 13:17:08 +00:00
|
|
|
foreach ( $databases as $db ) {
|
2004-08-02 12:26:43 +00:00
|
|
|
print "GRANT ALL PRIVILEGES ON `$db`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
|
2004-07-27 13:17:08 +00:00
|
|
|
}
|
2008-10-24 15:17:57 +00:00
|
|
|
print "\n-- nagios\n\n";
|
|
|
|
|
print "GRANT REPLICATION CLIENT ON *.* TO 'nagios'@'$host' IDENTIFIED BY '$nagios_pass';\n";
|
|
|
|
|
|
2004-07-27 13:54:03 +00:00
|
|
|
print "\n";
|
2004-07-27 13:17:08 +00:00
|
|
|
}
|
2007-06-29 01:19:14 +00:00
|
|
|
|