public function forumRelatedThreads() { $title = F::build('Title', array($this->app->wg->Title->getText()), 'newFromId'); $this->response->setVal('showModule', false); if (!empty($title) && $title->getNamespace() == NS_WIKIA_FORUM_BOARD_THREAD) { $rp = new WallRelatedPages(); $out = $rp->getMessageRelatetMessageIds(array($title->getArticleId())); $messages = array(); $count = 0; foreach ($out as $key => $val) { if ($title->getArticleId() == $val['comment_id']) { continue; } $msg = WallMessage::newFromId($val['comment_id']); if (!empty($msg)) { $msg->load(); $message = array('message' => $msg); if (!empty($val['last_child'])) { $childMsg = WallMessage::newFromId($val['last_child']); if (!empty($childMsg)) { $childMsg->load(); $message['reply'] = $childMsg; } } $messages[] = $message; $count++; if ($count == 5) { break; } } } $this->response->setVal('showModule', !empty($messages)); $this->response->setVal('messages', $messages); } }
public function getRelatedTopics() { $rp = new WallRelatedPages(); return $rp->getMessagesRelatedArticleTitles($this->getId()); }
/** * Fetch Forum discussions related to an article from the cache * @param int $articleId MediaWiki article id * @return array: Cache data */ public static function getData($articleId) { $key = wfMemcKey(__CLASS__, 'getData', $articleId); return WikiaDataAccess::cache($key, self::CACHE_EXPIRY, function () use($articleId) { $wlp = new WallRelatedPages(); $messages = $wlp->getArticlesRelatedMessgesSnippet($articleId, 2, 2); return $messages; }); }