$status = $wgUser->addToDatabase(); if ($status === null || $status->isOK()) { $dbw = wfGetDB(DB_MASTER); $dbw->update('user', array('user_password' => 'nologin'), array('user_name' => $username), $username); } } if (isset($options['n'])) { $dryRun = true; } else { $dryRun = false; } $sb = new SpamBlacklist($wgSpamBlacklistSettings); if ($wgSpamBlacklistFiles) { $sb->files = $wgSpamBlacklistFiles; } $regexes = $sb->getBlacklists(); if (!$regexes) { print "Invalid regex, can't clean up spam\n"; exit(1); } $dbr = wfGetDB(DB_SLAVE); $maxID = $dbr->selectField('page', 'MAX(page_id)'); $reportingInterval = 100; print "Regexes are " . implode(', ', array_map('count', $regexes)) . " bytes\n"; print "Searching for spam in {$maxID} pages...\n"; if ($dryRun) { print "Dry run only\n"; } for ($id = 1; $id <= $maxID; $id++) { if ($id % $reportingInterval == 0) { printf("%-8d %-5.2f%%\r", $id, $id / $maxID * 100);