/** * @static * @param $status * @param $article Article * @param int $parentId * @return array */ public static function doAfterPost($status, $article, $parentId = 0) { global $wgUser, $wgDBname; wfRunHooks('ArticleCommentAfterPost', array($status, &$article)); $commentId = $article->getID(); $error = false; $id = 0; switch ($status->value) { case EditPage::AS_SUCCESS_UPDATE: case EditPage::AS_SUCCESS_NEW_ARTICLE: $comment = ArticleComment::newFromArticle($article); $app = F::app(); $text = $app->getView('ArticleComments', $app->checkSkin('wikiamobile') ? 'WikiaMobileComment' : 'Comment', array('comment' => $comment->getData(true), 'commentId' => $commentId, 'rowClass' => '', 'level' => $parentId ? 2 : 1))->render(); if (!is_null($comment->mTitle)) { $id = $comment->mTitle->getArticleID(); } if (!empty($comment->mTitle)) { self::addArticlePageToWatchlist($comment); } $message = false; //commit before purging wfGetDB(DB_MASTER)->commit(); break; default: $userId = $wgUser->getId(); Wikia::log(__METHOD__, 'error', "No article created. Status: {$status->value}; DB: {$wgDBname}; User: {$userId}"); $text = false; $error = true; $message = wfMsg('article-comments-error'); } $res = array('commentId' => $commentId, 'error' => $error, 'id' => $id, 'msg' => $message, 'status' => $status, 'text' => $text); return $res; }