/**
  * Get a list of users, who want to suggest to edit this article. '
  * @param $title Title object for the article
  * @param minUserScore The minimum bytes a user needs to have added to an article for us to consider them as having contributed to that article
  */
 function getSuggestedUsers($title, $minUserScore = 200)
 {
     if (!$title || !$title->getText()) {
         return array();
     }
     $relatedTitles = DedupQuery::getRelated($title, 3);
     $userScore = array();
     foreach ($relatedTitles as $t) {
         if ($t['title']->getArticleId() == $title->getArticleId()) {
             continue;
         }
         if (in_array($t['title']->getArticleId(), $this->_relatedExcludes)) {
             continue;
         }
         $se = SuccessfulEdit::getEdits($t['title']->getArticleId());
         $userScore2 = array();
         foreach ($se as $e) {
             if (!isset($userScore2[$e['username']])) {
                 $userScore2[$e['username']] = 0;
             }
             $userScore2[$e['username']] += $e['added'];
         }
         foreach ($userScore2 as $username => $score) {
             if ($score > $minUserScore) {
                 $userScore[$username] = $score * $t['ct'];
                 $this->_userArticles[$username][$title->getArticleId()] += $score * $t['ct'];
                 $this->_userArticleRelated[$username][$title->getArticleId()][$t['title']->getArticleId()] = 1;
             }
         }
     }
     return $userScore;
 }
Example #2
0
<?php

require_once 'commandLine.inc';
global $IP;
require_once "{$IP}/extensions/wikihow/dedup/SuccessfulEdit.class.php";
if (sizeof($argv) != 1) {
    print "getRevertEdits [articleIdFile]\n";
    exit;
}
$f = fopen($argv[0], "r");
if (!$f) {
    print "Unable to open file\n";
    exit;
}
print "Article Id\tUsername\tBytes Added\tRevision\tGood Revision\n";
while (!feof($f)) {
    $l = fgets($f);
    $l = rtrim($l);
    $articleId = intval($l);
    if ($articleId != 0) {
        $se = SuccessfulEdit::getEdits($articleId);
        foreach ($se as $e) {
            print $articleId . "\t" . $e['username'] . "\t" . $e['added'] . "\t" . $e['rev'] . "\t" . $e["gr"] . "\n";
        }
    }
}