Reduce calls to wfTimestampNow() by using temporary variable. Inspired by CR on r88278.
[lhc/web/wiklou.git] / includes / specials / SpecialDeletedContributions.php
index 0e2215f..221a010 100644 (file)
@@ -55,7 +55,7 @@ class DeletedContribsPager extends IndexPager {
                // Paranoia: avoid brute force searches (bug 17792)
                if( !$wgUser->isAllowed( 'deletedhistory' ) ) {
                        $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::DELETED_USER) . ' = 0';
-               } else if( !$wgUser->isAllowed( 'suppressrevision' ) ) {
+               } elseif( !$wgUser->isAllowed( 'suppressrevision' ) ) {
                        $conds[] = $this->mDb->bitAnd('ar_deleted',Revision::SUPPRESSED_USER) .
                                ' != ' . Revision::SUPPRESSED_USER;
                }
@@ -63,7 +63,7 @@ class DeletedContribsPager extends IndexPager {
                        'tables' => array( 'archive' ),
                        'fields' => array(
                                'ar_rev_id', 'ar_namespace', 'ar_title', 'ar_timestamp', 'ar_comment', 'ar_minor_edit',
-                               'ar_user', 'ar_user_text', 'ar_deleted'
+                               'ar_user', 'ar_user_text', 'ar_deleted', 'ar_len'
                        ),
                        'conds' => $conds,
                        'options' => array( 'USE INDEX' => $index )
@@ -74,7 +74,7 @@ class DeletedContribsPager extends IndexPager {
                $condition = array();
 
                $condition['ar_user_text'] = $this->target;
-               $index = 'usertext_timestamp';
+               $index = array( 'archive' => 'ar_usertext_timestamp' );
 
                return array( $index, $condition );
        }
@@ -211,7 +211,7 @@ class DeletedContribsPager extends IndexPager {
                } else {
                        $mflag = '';
                }
-               
+
                // Revision delete link
                $canHide = $wgUser->isAllowed( 'deleterevision' );
                if( $canHide || ($rev->getVisibility() && $wgUser->isAllowed('deletedhistory')) ) {
@@ -234,9 +234,10 @@ class DeletedContribsPager extends IndexPager {
                        array( 'class' => 'mw-deletedcontribs-tools' ),
                        wfMsg( 'parentheses', $wgLang->pipeList( array( $last, $dellog, $reviewlink ) ) )
                );
-               
-               $ret = "{$del}{$link} {$tools} . . {$mflag} {$pagelink} {$comment}";
-               
+
+               $diffOut = Linker::formatRevisionSize( $row->ar_len );
+               $ret = "{$del}{$link} {$tools} . . {$mflag} {$diffOut} {$pagelink} {$comment}";
+
                # Denote if username is redacted for this edit
                if( $rev->isDeleted( Revision::DELETED_USER ) ) {
                        $ret .= " <strong>" . wfMsgHtml('rev-deleted-user-contribs') . "</strong>";
@@ -351,10 +352,10 @@ class DeletedContributionsPage extends SpecialPage {
         * @param $nt Title object for the target
         * @param $id Integer: User ID for the target
         * @return String: appropriately-escaped HTML to be output literally
-        * @todo Fixme: almost the same as contributionsSub in SpecialContributions.php. Could be combined.
+        * @todo FIXME: Almost the same as contributionsSub in SpecialContributions.php. Could be combined.
         */
        function getSubTitle( $nt, $id ) {
-               global $wgSysopUserBans, $wgLang, $wgUser, $wgOut;
+               global $wgLang, $wgUser, $wgOut;
 
                $sk = $wgUser->getSkin();
 
@@ -368,11 +369,11 @@ class DeletedContributionsPage extends SpecialPage {
                if( $talk ) {
                        # Talk page link
                        $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) );
-                       if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
+                       if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) {
                                if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links
                                        if ( $userObj->isBlocked() ) {
                                                $tools[] = $sk->linkKnown( # Change block link
-                                                       SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
+                                                       SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
                                                        wfMsgHtml( 'change-blocklink' )
                                                );
                                                $tools[] = $sk->linkKnown( # Unblock link
@@ -381,13 +382,13 @@ class DeletedContributionsPage extends SpecialPage {
                                                        array(),
                                                        array(
                                                                'action' => 'unblock',
-                                                               'ip' => $nt->getDBkey() 
+                                                               'ip' => $nt->getDBkey()
                                                        )
                                                );
                                        }
                                        else { # User is not blocked
                                                $tools[] = $sk->linkKnown( # Block link
-                                                       SpecialPage::getTitleFor( 'Blockip', $nt->getDBkey() ),
+                                                       SpecialPage::getTitleFor( 'Block', $nt->getDBkey() ),
                                                        wfMsgHtml( 'blocklink' )
                                                );
                                        }
@@ -453,7 +454,7 @@ class DeletedContributionsPage extends SpecialPage {
                // languages that want to put the "for" bit right after $user but before
                // $links.  If 'contribsub' is around, use it for reverse compatibility,
                // otherwise use 'contribsub2'.
-               if( wfEmptyMsg( 'contribsub', wfMsg( 'contribsub' ) ) ) {
+               if( wfEmptyMsg( 'contribsub' ) ) {
                        return wfMsgHtml( 'contribsub2', $user, $links );
                } else {
                        return wfMsgHtml( 'contribsub', "$user ($links)" );