# Collate list of users
$userlinks = array();
# Other properties
- $unpatrolled = false;
- $isnew = false;
- $allBots = true;
- $allMinors = true;
$curId = 0;
# Some catalyst variables...
$namehidden = true;
$allLogs = true;
$RCShowChangedSize = $this->getConfig()->get( 'RCShowChangedSize' );
+ $collectedRcFlags = array(
+ // All are by bots?
+ 'bot' => true,
+ // Includes a new page?
+ 'newpage' => false,
+ // All are minor edits?
+ 'minor' => true,
+ // Contains an unpatrolled edit?
+ 'unpatrolled' => false,
+ );
foreach ( $block as $rcObj ) {
if ( $rcObj->mAttribs['rc_type'] == RC_NEW ) {
- $isnew = true;
+ $collectedRcFlags['newpage'] = true;
}
// If all log actions to this page were hidden, then don't
// give the name of the affected page for this block!
$userlinks[$u] = 0;
}
if ( $rcObj->unpatrolled ) {
- $unpatrolled = true;
+ $collectedRcFlags['unpatrolled'] = true;
}
if ( $rcObj->mAttribs['rc_type'] != RC_LOG ) {
$allLogs = false;
}
if ( !$rcObj->mAttribs['rc_bot'] ) {
- $allBots = false;
+ $collectedRcFlags['bot'] = false;
}
if ( !$rcObj->mAttribs['rc_minor'] ) {
- $allMinors = false;
+ $collectedRcFlags['minor'] = false;
}
$userlinks[$u]++;
$r .= "<td>$tl</td>";
# Main line
- $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags( array(
- 'newpage' => $isnew, # show, when one have this flag
- 'minor' => $allMinors, # show only, when all have this flag
- 'unpatrolled' => $unpatrolled, # show, when one have this flag
- 'bot' => $allBots, # show only, when all have this flag
- ) );
+ $r .= '<td class="mw-enhanced-rc">' . $this->recentChangesFlags(
+ $collectedRcFlags
+ );
# Timestamp
$r .= ' ' . $block[0]->timestamp . ' </td><td>';
return '';
}
- $r .= $this->getLogText( $block, $queryParams, $allLogs, $isnew, $namehidden );
+ $r .= $this->getLogText( $block, $queryParams, $allLogs,
+ $collectedRcFlags['newpage'], $namehidden );
$r .= ' <span class="mw-changeslist-separator">. .</span> ';
if ( $rcObj->mAttribs['rc_type'] == RC_LOG ) {
$data['logEntry'] = $this->insertLogEntry( $rcObj );
+ } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
+ $data['comment'] = $this->insertComment( $rcObj );
} else {
# User links
$data['userLink'] = $rcObj->userlink;
/** @var $block0 RecentChange */
$block0 = $block[0];
$last = $block[count( $block ) - 1];
- if ( !$allLogs ) {
+ if ( !$allLogs && $rcObj->mAttribs['rc_type'] != RC_CATEGORIZE ) {
if ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
$links['total-changes'] = $nchanges[$n];
} elseif ( $isnew ) {
}
# History
- if ( $allLogs ) {
+ if ( $allLogs || $rcObj->mAttribs['rc_type'] == RC_CATEGORIZE ) {
// don't show history link for logs
} elseif ( $namehidden || !$block0->getTitle()->exists() ) {
$links['history'] = $this->message['enhancedrc-history'];
}
# Diff and hist links
- if ( $type != RC_LOG ) {
+ if ( $type != RC_LOG && $type != RC_CATEGORIZE ) {
$query['action'] = 'history';
- $data['historyLink'] = ' ' . $this->msg( 'parentheses' )
- ->rawParams( $rcObj->difflink . $this->message['pipe-separator'] . Linker::linkKnown(
- $rcObj->getTitle(),
- $this->message['hist'],
- array(),
- $query
- ) )->escaped();
+ $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
}
$data['separatorAfterLinks'] = ' <span class="mw-changeslist-separator">. .</span> ';
if ( $type == RC_LOG ) {
$data['logEntry'] = $this->insertLogEntry( $rcObj );
+ } elseif ( $this->isCategorizationWithoutRevision( $rcObj ) ) {
+ $data['comment'] = $this->insertComment( $rcObj );
} else {
$data['userLink'] = $rcObj->userlink;
$data['userTalkLink'] = $rcObj->usertalklink;
$data['comment'] = $this->insertComment( $rcObj );
+ if ( $type == RC_CATEGORIZE ) {
+ $data['historyLink'] = $this->getDiffHistLinks( $rcObj, $query );
+ }
$data['rollback'] = $this->getRollback( $rcObj );
}
return $line;
}
+ /**
+ * 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'] . Linker::linkKnown(
+ $pageTitle,
+ $this->message['hist'],
+ array(),
+ $query
+ ) )->escaped();
+ return $retVal;
+ }
+
/**
* If enhanced RC is in use, this function takes the previously cached
* RC lines, arranges them, and outputs the HTML