Exemplo n.º 1
0
 /**
  * @param array $expectedParseParams
  * @param string|null $rawRcParams
  */
 protected function assertParseParams($expectedParseParams, $rawRcParams)
 {
     $rc = new RecentChange();
     $rc->setAttribs(['rc_params' => $rawRcParams]);
     $actualParseParams = $rc->parseParams();
     $this->assertEquals($expectedParseParams, $actualParseParams);
 }
 private function makeRecentChange($attribs, $counter, $watchingUsers)
 {
     $change = new RecentChange();
     $change->setAttribs($attribs);
     $change->counter = $counter;
     $change->numberofWatchingusers = $watchingUsers;
     return $change;
 }
Exemplo n.º 3
0
 /**
  * Hook
  *
  * @param RecentChange $oRC -- instance of RecentChange class
  *
  * @static
  * @access public
  *
  * @return Bool true -- because it's a hook
  */
 public static function watchlistNotify(RecentChange &$oRC)
 {
     global $wgEnableGroupedArticleCommentsRC;
     wfProfileIn(__METHOD__);
     wfRunHooks('AC_RecentChange_Save', array(&$oRC));
     if (!empty($wgEnableGroupedArticleCommentsRC) && $oRC instanceof RecentChange) {
         $title = $oRC->getAttribute('rc_title');
         $namespace = $oRC->getAttribute('rc_namespace');
         $article_id = $oRC->getAttribute('rc_cur_id');
         $title = Title::newFromText($title, $namespace);
         //TODO: review
         if (MWNamespace::isTalk($namespace) && ArticleComment::isTitleComment($title) && !empty($article_id)) {
             $comment = ArticleComment::newFromId($article_id);
             if ($comment instanceof ArticleComment) {
                 $oArticlePage = $comment->getArticleTitle();
                 $mAttribs = $oRC->mAttribs;
                 $mAttribs['rc_title'] = $oArticlePage->getDBkey();
                 $mAttribs['rc_namespace'] = $oArticlePage->getNamespace();
                 $mAttribs['rc_log_action'] = 'article_comment';
                 $oRC->setAttribs($mAttribs);
             }
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }