$wgDeferredUpdateList = array();
        $wgPostCommitUpdateList = array();
    }
}
//------------------------------------------------------------------------------
$wgUser = User::newFromName('Spam cleanup script');
if (isset($options['n'])) {
    $dryRun = true;
} else {
    $dryRun = false;
}
$sb = new SpamBlacklist($wgSpamBlacklistSettings);
if ($wgSpamBlacklistFiles) {
    $sb->files = $wgSpamBlacklistFiles;
}
$regex = $sb->getRegex();
if (!$regex) {
    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 "Regex is " . strlen($regex) . " bytes\n";
if (strlen($regex) < 10000 || strlen($regex) > 32000) {
    print "wrong size, exiting\n";
    exit(1);
}
print "Searching for spam in {$maxID} pages...\n";
if ($dryRun) {
    print "Dry run only\n";