global $wgRequest, $wgUser;
$purge = $wgRequest->getVal( 'action' ) === 'purge';
+ // Allow users with 'purge' right to clear feed caches
if ( $purge && $wgUser->isAllowed( 'purge' ) ) {
$cache = ObjectCache::getMainWANInstance();
$cache->delete( $timekey, 1 );
/**
* Format a diff for the newsfeed
*
- * @param object $row Row from the recentchanges table
+ * @param object $row Row from the recentchanges table, including fields as
+ * appropriate for CommentStore
* @return string
*/
public static function formatDiff( $row ) {
$timestamp,
$row->rc_deleted & Revision::DELETED_COMMENT
? wfMessage( 'rev-deleted-comment' )->escaped()
- : $row->rc_comment,
+ : CommentStore::newKey( 'rc_comment' )
+ // Legacy from RecentChange::selectFields() via ChangesListSpecialPage::doMainQuery()
+ ->getCommentLegacy( wfGetDB( DB_REPLICA ), $row )->text,
$actiontext
);
}
// log entries
$completeText = '<p>' . implode( ' ',
array_filter(
- array(
+ [
$actiontext,
- Linker::formatComment( $comment ) ) ) ) . "</p>\n";
+ Linker::formatComment( $comment ) ] ) ) . "</p>\n";
// NOTE: Check permissions for anonymous users, not current user.
// No "privileged" version should end up in the cache.
}
if ( $oldid ) {
-
- # $diffText = $de->getDiff( wfMessage( 'revisionasof',
- # $wgLang->timeanddate( $timestamp ),
- # $wgLang->date( $timestamp ),
- # $wgLang->time( $timestamp ) )->text(),
- # wfMessage( 'currentrev' )->text() );
-
$diffText = '';
// Don't bother generating the diff if we won't be able to show it
if ( $wgFeedDiffCutoff > 0 ) {
}
if ( $html === null ) {
-
- // Omit large new page diffs, bug 29110
+ // Omit large new page diffs, T31110
// Also use diff link for non-textual content
$diffText = self::getDiffLink( $title, $newid );
} else {
* @return string
*/
protected static function getDiffLink( Title $title, $newid, $oldid = null ) {
- $queryParameters = array( 'diff' => $newid );
+ $queryParameters = [ 'diff' => $newid ];
if ( $oldid != null ) {
$queryParameters['oldid'] = $oldid;
}
$diffUrl = $title->getFullURL( $queryParameters );
- $diffLink = Html::element( 'a', array( 'href' => $diffUrl ),
+ $diffLink = Html::element( 'a', [ 'href' => $diffUrl ],
wfMessage( 'showdiff' )->inContentLanguage()->text() );
return $diffLink;
* @return string Modified HTML
*/
public static function applyDiffStyle( $text ) {
- $styles = array(
+ $styles = [
'diff' => 'background-color: white; color:black;',
'diff-otitle' => 'background-color: white; color:black; text-align: center;',
'diff-ntitle' => 'background-color: white; color:black; text-align: center;',
. 'border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; '
. 'border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;',
'diffchange' => 'font-weight: bold; text-decoration: none;',
- );
+ ];
foreach ( $styles as $class => $style ) {
$text = preg_replace( "/(<[^>]+)class=(['\"])$class\\2([^>]*>)/",