- global $wgLang, $wgContLang, $wgUser;
- $dm = $wgContLang->getDirMark();
-
- $title = Title::makeTitleSafe( $result->page_namespace, $result->page_title );
- $time = $wgLang->timeAndDate( $result->rc_timestamp, true );
- $plink = $this->skin->makeKnownLinkObj( $title, '', $this->patrollable( $result ) ? 'rcid=' . $result->rc_id : '' );
- $hist = $this->skin->makeKnownLinkObj( $title, wfMsgHtml( 'hist' ), 'action=history' );
- $length = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
- $wgLang->formatNum( $result->length ) );
- $ulink = $this->skin->userLink( $result->rc_user, $result->rc_user_text ) . ' ' .
- $this->skin->userToolLinks( $result->rc_user, $result->rc_user_text );
- $comment = $this->skin->commentBlock( $result->rc_comment );
- $css = $this->patrollable( $result ) ? " class='not-patrolled'" : '';
-
- return "<li{$css}>{$time} {$dm}{$plink} ({$hist}) {$dm}[{$length}] {$dm}{$ulink} {$comment}</li>\n";
+ # Revision deletion works on revisions, so we should cast one
+ $row = array(
+ 'comment' => $result->rc_comment,
+ 'deleted' => $result->rc_deleted,
+ 'user_text' => $result->rc_user_text,
+ 'user' => $result->rc_user,
+ );
+ $rev = new Revision( $row );
+
+ $classes = array();
+
+ $lang = $this->getLanguage();
+ $dm = $lang->getDirMark();
+
+ $title = Title::newFromRow( $result );
+ $spanTime = Html::element( 'span', array( 'class' => 'mw-newpages-time' ),
+ $lang->timeanddate( $result->rc_timestamp, true )
+ );
+ $time = Linker::linkKnown(
+ $title,
+ $spanTime,
+ array(),
+ array( 'oldid' => $result->rc_this_oldid ),
+ array()
+ );
+
+ $query = array( 'redirect' => 'no' );
+
+ if( $this->patrollable( $result ) ) {
+ $query['rcid'] = $result->rc_id;
+ }
+
+ $plink = Linker::linkKnown(
+ $title,
+ null,
+ array( 'class' => 'mw-newpages-pagename' ),
+ $query,
+ array( 'known' ) // Set explicitly to avoid the default of 'known','noclasses'. This breaks the colouration for stubs
+ );
+ $histLink = Linker::linkKnown(
+ $title,
+ wfMsgHtml( 'hist' ),
+ array(),
+ array( 'action' => 'history' )
+ );
+ $hist = Html::rawElement( 'span', array( 'class' => 'mw-newpages-history' ), wfMsg( 'parentheses', $histLink ) );
+
+ $length = Html::element( 'span', array( 'class' => 'mw-newpages-length' ),
+ '[' . $this->msg( 'nbytes' )->numParams( $result->length )->text() . ']'
+ );
+
+ $ulink = Linker::revUserTools( $rev );
+ $comment = Linker::revComment( $rev );
+
+ if ( $this->patrollable( $result ) ) {
+ $classes[] = 'not-patrolled';
+ }
+
+ # Add a class for zero byte pages
+ if ( $result->length == 0 ) {
+ $classes[] = 'mw-newpages-zero-byte-page';
+ }
+
+ # Tags, if any. check for including due to bug 23293
+ if ( !$this->including() ) {
+ list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $result->ts_tags, 'newpages' );
+ $classes = array_merge( $classes, $newClasses );
+ } else {
+ $tagDisplay = '';
+ }
+
+ $css = count( $classes ) ? ' class="' . implode( ' ', $classes ) . '"' : '';
+
+ # Display the old title if the namespace/title has been changed
+ $oldTitleText = '';
+ $oldTitle = Title::makeTitle( $result->rc_namespace, $result->rc_title );
+ if ( !$title->equals( $oldTitle ) ) {
+ $oldTitleText = wfMessage( 'rc-old-title' )->params( $oldTitle->getPrefixedText() )->escaped();
+ }
+
+ return "<li{$css}>{$time} {$dm}{$plink} {$hist} {$dm}{$length} {$dm}{$ulink} {$comment} {$tagDisplay} {$oldTitleText}</li>\n";