public function prepareData($res)
 {
     $data = [];
     $dbr = wfGetDB(DB_SLAVE);
     while ($row = $dbr->fetchObject($res)) {
         if ($row->title) {
             $article = [];
             $params = $this->getUrlParams();
             $title = Title::newFromText($row->title, $row->namespace);
             if ($title === null) {
                 continue;
             }
             $article['link'] = InsightsHelper::getTitleLink($title, $params);
             $article['metadata']['wantedBy'] = $this->makeWlhLink($title, $row);
             $data[] = $article;
         }
     }
     return $data;
 }
 /**
  * Get params to generate link back to edit mode
  *
  * @param Title $title
  * @param InsightsModel $model
  */
 private function getInsightFixItParams(Title $title, InsightsModel $model)
 {
     $link = InsightsHelper::getTitleLink($title, $model->getUrlParams());
     return ['editPageText' => wfMessage('insights-notification-message-fixit')->plain(), 'editPageLink' => $link['url']];
 }
Пример #3
0
 /**
  * Get data for the next element that a user can take care of.
  *
  * @param string $type A key of a Querypage
  * @param string $articleName A title of an article
  * @return Array The next item's data
  */
 public function getNextItem($type, $articleName)
 {
     $next = [];
     $dbr = wfGetDB(DB_SLAVE);
     $articleName = $dbr->strencode($articleName);
     $res = $dbr->select('querycache', 'qc_title', ['qc_type' => ucfirst($type), "qc_title != '{$articleName}'"], 'DatabaseBase::select', ['LIMIT' => 1]);
     if ($res->numRows() > 0) {
         $row = $dbr->fetchObject($res);
         $title = Title::newFromText($row->qc_title);
         $next['link'] = InsightsHelper::getTitleLink($title, self::getUrlParams());
     }
     return $next;
 }