<?php require_once 'commandLine.inc'; $res = DatabaseHelper::batchSelect("nfd", array('nfd_page'), array('nfd_status' => 0), __FILE__, array("GROUP BY" => 'nfd_page')); foreach ($res as $result) { $title = Title::newFromID($result->nfd_page); if (!$title) { NFDProcessor::markPreviousAsInactive($result->nfd_page); echo "Removing {$result->nfd_page}\n"; usleep(500000); } }
function wfRemoveNFD($wikiPage) { NFDProcessor::markPreviousAsInactive($wikiPage->getId()); return true; }
public static function checkArticlesInNfdTable() { $dbr = wfGetDB(DB_SLAVE); $count = 0; $results = array(); $res = $dbr->select('nfd', array('nfd_id', 'nfd_page', 'nfd_reason'), array('nfd_patrolled' => '0', "(nfd_status = '" . NFDGuardian::NFD_AVAILABLE . "' OR nfd_status = '" . NFDGuardian::NFD_ADVANCED . "')")); while ($result = $dbr->fetchObject($res)) { $results[] = $result; } foreach ($results as $result) { $t = Title::newFromID($result->nfd_page); if ($t) { $a = new Article($t); /*if($result->nfd_reason == "dup"){ NFDProcessor::markPreviousAsInactive($result->nfd_page); echo "Removing Dup: " . $t->getText() . "\n"; $count++; } else*/ if ($a->isRedirect()) { //check if its a redirect NFDProcessor::markPreviousAsInactive($result->nfd_page); echo "Removing Redirect: " . $t->getText() . "\n"; $count++; } else { //check to see if it still has an NFD tag $revision = Revision::newFromTitle($t); if ($a && $revision) { $l = new NFDProcessor($revision, $a); $l->process(true); } } } else { //title doesn't exist, so remove it from the db NFDProcessor::markPreviousAsInactive($result->nfd_page); echo "Title no longer exists: " . $result->nfd_page . "\n"; $count++; } } //echo "Removed a total of " . $count . " articles from tool.\n"; }
function wfRemoveNFD(Article &$article, User &$user, $reason) { NFDProcessor::markPreviousAsInactive($article->getID()); return true; }