示例#1
0
    preg_match('/\\((.*?) of/i', $status['fscanprogress'], $previousoffset);
    $a = $status['fbladd'];
    $previousoffset = $previousoffset[1];
}
echo "----------RUN TIMESTAMP: " . date('r') . "----------\n\n";
echo "Retrieving blacklists...\n\n";
$status = array('fstatus' => 'scan', 'fbladd' => $a, 'fscanprogress' => 'x');
updateStatus();
$globalblacklistregex = $site2->initPage('Spam blacklist')->get_text();
$globalblacklistregexarray = explode("\n", $globalblacklistregex);
$blacklistregex = $site->initPage('MediaWiki:Spam-blacklist')->get_text();
$blacklistregexarray = explode("\n", $blacklistregex);
$blacklistregex = buildSafeRegexes(array_merge($blacklistregexarray, $globalblacklistregexarray));
$whitelistregex = $site->initPage('MediaWiki:Spam-whitelist')->get_text();
$whitelistregexarray = explode("\n", $whitelistregex);
$whitelistregex = buildSafeRegexes($whitelistregexarray);
$dblocal = mysqli_connect('tools-db', $toolserver_username, $toolserver_password, 's51059__cyberbot');
$dbwiki = mysqli_connect('enwiki.labsdb', $toolserver_username, $toolserver_password, 'enwiki_p');
$res = mysqli_query($dbwiki, "SELECT COUNT(*) AS count FROM externallinks;");
$linkcount = mysqli_fetch_assoc($res);
$linkcount = $linkcount['count'];
mysqli_free_result($res);
$offset = 0;
if (isset($previousoffset)) {
    $offset = $previousoffset;
    unset($previousoffset);
}
$completed = 0;
$completed = $offset / $linkcount * 100;
//compile the pages containing blacklisted URLs
echo "Scanning {$linkcount} externallinks in the database...\n\n";
示例#2
0
        $completedin = 2 * ((time() - $starttime) * 100 / $completed - (time() - $starttime));
        $completedby = time() + $completedin;
        $status = array('status' => 'scan', 'bladd' => $a, 'bldeleted' => $d, 'blexception' => $e, 'scanprogress' => round($completed, 3) . "% ({$offset} of {$linkcount})", 'scantype' => 'replica', 'scaneta' => round($completedby, 0));
        updateStatus();
        updateData();
    }
}
unset($rundata['offset']);
unset($rundata['linkcount']);
unset($rundata['starttime']);
mysqli_close($dbwiki);
mysqli_close($dblocal);
findrule:
$globalblacklistregexarray = explode("\n", $site2->initPage('Spam blacklist')->get_text());
$blacklistregexarray = explode("\n", $site->initPage('MediaWiki:Spam-blacklist')->get_text());
$whitelistregex = buildSafeRegexes(explode("\n", $site->initPage('MediaWiki:Spam-whitelist')->get_text()));
$starttime = time();
$i = 0;
$count = count($pagebuffer);
$status = array('status' => 'process', 'bladd' => $a, 'bldeleted' => $d, 'blexception' => $e, 'scanprogress' => "0% (0 of {$count})", 'scantype' => 'x');
updateStatus();
//Check to make sure some things are still updated.  Remove outdated entries.
$i = 0;
foreach ($pagebuffer as $id => $page) {
    $i++;
    if (empty($page['urls']) || !isset($page['urls'])) {
        unset($pagebuffer[$id]);
        continue;
    }
    //check if it has been whitelisted/deblacklisted during the database scan and make sure it isn't catching itself.
    $pagedata = $site->initPage(null, $id)->get_text();