コード例 #1
0
 /**
  * @deprecated legacy entry point for cached JS requests
  */
 public function checkData()
 {
     $articleId = $this->getVal('articleId');
     $title = Title::newFromId($articleId);
     if (empty($articleId) || empty($title)) {
         $this->replace = false;
         $this->articleId = $articleId;
         return;
     }
     $messages = RelatedForumDiscussionController::getData($articleId);
     $timediff = time() - $messages['lastupdate'];
     $this->lastupdate = $messages['lastupdate'];
     $this->timediff = $timediff;
     unset($messages['lastupdate']);
     if ($timediff < 24 * 60 * 60) {
         $this->replace = true;
         $this->html = $this->app->renderView("RelatedForumDiscussion", "relatedForumDiscussion", array('messages' => $messages));
     } else {
         $this->replace = false;
         $this->html = '';
     }
     $this->response->setFormat(WikiaResponse::FORMAT_JSON);
     $this->response->setCacheValidity(6 * 60 * 60, WikiaResponse::CACHE_DISABLED);
 }
コード例 #2
0
 /**
  * purge memc and vernish cache for pages releated to this thread
  *
  * in case of edit this hook is run two time before (WallBeforeEdit) edit and after edit (WallAction)
  *
  */
 public static function onWallAction($action, $parent, $comment_id)
 {
     $title = Title::newFromId($comment_id, Title::GAID_FOR_UPDATE);
     if (!empty($title) && MWNamespace::getSubject($title->getNamespace()) == NS_WIKIA_FORUM_BOARD) {
         $threadId = empty($parent) ? $comment_id : $parent;
         RelatedForumDiscussionController::purgeCache($threadId);
         //cleare board info
         $commentsIndex = CommentsIndex::newFromId($comment_id);
         if (empty($commentsIndex)) {
             return true;
         }
         $board = ForumBoard::newFromId($commentsIndex->getParentPageId());
         if (empty($board)) {
             return true;
         }
         $thread = WallThread::newFromId($threadId);
         if (!empty($thread)) {
             $thread->purgeLastMessage();
         }
     }
     return true;
 }