/** * @todo use rc_source to group, if set; fallback to rc_type * * @param RCCacheEntry $cacheEntry * * @return string */ protected function makeCacheGroupingKey(RCCacheEntry $cacheEntry) { $title = $cacheEntry->getTitle(); $cacheGroupingKey = $title->getPrefixedDBkey(); $type = $cacheEntry->mAttribs['rc_type']; if ($type == RC_LOG) { // Group by log type $cacheGroupingKey = SpecialPage::getTitleFor('Log', $cacheEntry->mAttribs['rc_log_type'])->getPrefixedDBkey(); } return $cacheGroupingKey; }
/** * Hook * * @desc Changes $secureName in MW ChangesList.php #L815 so Article Comments and extensions which are based on AC (as long as those extensions doesn't have their own hook) * * @param ChangesList $oChangeList -- instance of ChangeList class * @param String $currentName -- current value of RC key * @param RCCacheEntry $oRCCacheEntry -- instance of RCCacheEntry class * * @static * @access public * * @return boolean -- because it's a hook */ public static function makeChangesListKey($oChangeList, &$currentName, $oRCCacheEntry) { global $wgEnableGroupedArticleCommentsRC; if (empty($wgEnableGroupedArticleCommentsRC)) { return true; } wfProfileIn(__METHOD__); $oTitle = $oRCCacheEntry->getTitle(); $namespace = $oTitle->getNamespace(); if (MWNamespace::isTalk($namespace) && ArticleComment::isTitleComment($oTitle)) { $parts = ArticleComment::explode($oTitle->getText()); if ($parts['title'] != '') { $currentName = 'ArticleComments' . $parts['title']; } } wfProfileOut(__METHOD__); return true; }
/** * Returns value to be used in 'historyLink' element of $data param in * EnhancedChangesListModifyBlockLineData hook. * * @since 1.27 * * @param RCCacheEntry $rc * @param array $query array of key/value pairs to append as a query string * @return string HTML */ public function getDiffHistLinks(RCCacheEntry $rc, array $query) { $pageTitle = $rc->getTitle(); if ($rc->getAttribute('rc_type') == RC_CATEGORIZE) { // For categorizations we must swap the category title with the page title! $pageTitle = Title::newFromID($rc->getAttribute('rc_cur_id')); } $retVal = ' ' . $this->msg('parentheses')->rawParams($rc->difflink . $this->message['pipe-separator'] . $this->linkRenderer->makeKnownLink($pageTitle, new HtmlArmor($this->message['hist']), [], $query))->escaped(); return $retVal; }
/** * Put accumulated information into the cache, for later display. * Page moves go on their own line. * * @param RCCacheEntry $cacheEntry */ protected function addCacheEntry(RCCacheEntry $cacheEntry) { $title = $cacheEntry->getTitle(); $secureName = $title->getPrefixedDBkey(); $type = $cacheEntry->mAttribs['rc_type']; if ($type == RC_MOVE || $type == RC_MOVE_OVER_REDIRECT) { # Use an @ character to prevent collision with page names $this->rc_cache['@@' . $this->rcMoveIndex++] = array($cacheEntry); } else { # Logs are grouped by type if ($type == RC_LOG) { $secureName = SpecialPage::getTitleFor('Log', $cacheEntry->mAttribs['rc_log_type'])->getPrefixedDBkey(); } if (!isset($this->rc_cache[$secureName])) { $this->rc_cache[$secureName] = array(); } array_push($this->rc_cache[$secureName], $cacheEntry); } }