-- profiling table
-- This is optional
-CREATE TABLE /*$wgDBprefix*/profiling (
- pf_count integer not null default 0,
- pf_time float not null default 0,
- pf_name varchar(255) not null default '',
- UNIQUE KEY pf_name (pf_name)
-);
-
+CREATE TABLE profiling (
+ pf_count int(11) NOT NULL default '0',
+ pf_time float NOT NULL default '0',
+ pf_name varchar(255) NOT NULL default '',
+ pf_server varchar(30) NOT NULL default '',
+ UNIQUE KEY pf_name_server (pf_name,pf_server)
+) TYPE=HEAP;
+
}
//------------------------------------------------------------------------------
+
+
+
$username = wfMsg( 'spambot_username' );
$fname = $username;
$wgUser = User::newFromName( $username );
$dbr =& wfGetDB( DB_SLAVE );
-$res = $dbr->select( 'externallinks', array( 'el_from' ),
- array( 'el_index LIKE ' . $dbr->addQuotes( $like ) ), $fname );
-$count = $dbr->numRows( $res );
-print "Found $count articles containing $spec\n";
-while ( $row = $dbr->fetchObject( $res ) ) {
- cleanupArticle( $row->el_from, $spec );
-}
-if ( $count ) {
- print "Done\n";
+if ( $options['all'] ) {
+ // Clean up spam on all wikis
+ $dbr =& wfGetDB( DB_SLAVE );
+ print "Finding spam on " . count($wgLocalDatabases) . " wikis\n";
+ $found = false;
+ foreach ( $wgLocalDatabases as $db ) {
+ $count = $dbr->selectField( "`$db`.externallinks", 'COUNT(*)',
+ array( 'el_index LIKE ' . $dbr->addQuotes( $like ) ), $fname );
+ if ( $count ) {
+ $found = true;
+ passthru( "php cleanupSpam.php $db $spec | sed s/^/$db: /" );
+ }
+ }
+ if ( $found ) {
+ print "All done\n";
+ } else {
+ print "None found\n";
+ }
+} else {
+ // Clean up spam on this wiki
+ $res = $dbr->select( 'externallinks', array( 'DISTINCT el_from' ),
+ array( 'el_index LIKE ' . $dbr->addQuotes( $like ) ), $fname );
+ $count = $dbr->numRows( $res );
+ print "Found $count articles containing $spec\n";
+ while ( $row = $dbr->fetchObject( $res ) ) {
+ cleanupArticle( $row->el_from, $spec );
+ }
+ if ( $count ) {
+ print "Done\n";
+ }
}
?>
require_once('commandLine.inc');
foreach ( $wgLocalDatabases as $db ) {
+ noisyDelete("$db:stats:request_with_session");
+ noisyDelete("$db:stats:request_without_session");
noisyDelete("$db:stats:pcache_hit");
noisyDelete("$db:stats:pcache_miss_invalid");
noisyDelete("$db:stats:pcache_miss_expired");
noisyDelete("$db:stats:pcache_miss_absent");
+ noisyDelete("$db:stats:pcache_miss_stub");
noisyDelete("$db:stats:image_cache_hit");
noisyDelete("$db:stats:image_cache_miss");
noisyDelete("$db:stats:image_cache_update");
+ noisyDelete("$db:stats:diff_cache_hit");
+ noisyDelete("$db:stats:diff_cache_miss");
+ noisyDelete("$db:stats:diff_uncacheable");
}
function noisyDelete( $key ) {
$self = array_shift( $argv );
$self = __FILE__;
$IP = realpath( dirname( $self ) . '/..' );
-chdir( $IP );
+#chdir( $IP );
$options = array();
$args = array();
if ( file_exists( '/home/wikipedia/common/langlist' ) ) {
$wgWikiFarm = true;
- require_once( $IP.'/includes/SiteConfiguration.php' );
+ $cluster = trim( file_get_contents( '/etc/cluster' ) );
+ require_once( "$IP/includes/SiteConfiguration.php" );
- # Get $conf
- require( $IP.'/InitialiseSettings.php' );
+ # Get $wgConf
+ require( "$IP/wgConf.php" );
if ( empty( $wgNoDBParam ) ) {
# Check if we were passed a db name
$DP = $IP;
ini_set( 'include_path', ".:$IP:$IP/includes:$IP/languages:$IP/maintenance" );
+ require_once( $IP.'/includes/ProfilerStub.php' );
require_once( $IP.'/includes/Defines.php' );
require_once( $IP.'/CommonSettings.php' );
+ $bin = '/home/wikipedia/bin';
if ( $wgUseRootUser ) {
$wgDBuser = $wgDBadminuser = 'root';
- $wgDBpassword = $wgDBadminpassword = trim(`mysql_root_pass`);
+ $wgDBpassword = $wgDBadminpassword = trim(`$bin/mysql_root_pass`);
} elseif ( !$wgUseNormalUser ) {
$wgDBuser = $wgDBadminuser = 'wikiadmin';
- $wgDBpassword = $wgDBadminpassword = trim(`wikiadmin_pass`);
+ $wgDBpassword = $wgDBadminpassword = trim(`$bin/wikiadmin_pass`);
}
} else {
$wgWikiFarm = false;
}
$wgCommandLineMode = true;
$DP = $IP;
+ require_once( $IP.'/includes/ProfilerStub.php' );
require_once( $IP.'/includes/Defines.php' );
require_once( $settingsFile );
ini_set( 'include_path', ".$sep$IP$sep$IP/includes$sep$IP/languages$sep$IP/maintenance" );
'207.142.131.197',
'207.142.131.198',
'207.142.131.199',
+ '207.142.131.221',
'207.142.131.226',
'207.142.131.227',
'207.142.131.228',
print "--\n-- $host\n--\n\n-- wikiuser\n\n";
print "GRANT REPLICATION CLIENT,PROCESS ON *.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
print "GRANT ALL PRIVILEGES ON `boardvote`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
+ print "GRANT ALL PRIVILEGES ON `boardvote2005`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
foreach( $databases as $db ) {
print "GRANT SELECT, INSERT, UPDATE, DELETE ON `$db`.* TO 'wikiuser'@'$host' IDENTIFIED BY '$wikiuser_pass';\n";
}
print "\n-- wikiadmin\n\n";
print "GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'wikiadmin'@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
print "GRANT ALL PRIVILEGES ON `boardvote`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
+ print "GRANT ALL PRIVILEGES ON `boardvote2005`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
foreach ( $databases as $db ) {
print "GRANT ALL PRIVILEGES ON `$db`.* TO wikiadmin@'$host' IDENTIFIED BY '$wikiadmin_pass';\n";
}
// Trigger errors on inappropriate use of $wgTitle
$wgTitle = new FakeTitle;
-while ( false != ($job = Job::pop()) ) {
- wfWaitForSlaves( 5 );
- print $job->toString() . "\n";
- if ( !$job->run() ) {
- print "Error: {$job->error}\n";
+$dbw =& wfGetDB( DB_MASTER );
+while ( $dbw->selectField( 'job', 'count(*)', '', 'runJobs.php' ) ) {
+ while ( false != ($job = Job::pop()) ) {
+ wfWaitForSlaves( 5 );
+ print $job->id . " " . $job->toString() . "\n";
+ if ( !$job->run() ) {
+ print "Error: {$job->error}\n";
+ }
}
}
-