Index: trunk/phase3/includes/specials/SpecialShortpages.php |
— | — | @@ -61,16 +61,17 @@ |
62 | 62 | function preprocessResults( $db, $res ) { |
63 | 63 | # There's no point doing a batch check if we aren't caching results; |
64 | 64 | # the page must exist for it to have been pulled out of the table |
65 | | - if( $this->isCached() ) { |
66 | | - $batch = new LinkBatch(); |
67 | | - foreach ( $res as $row ) { |
68 | | - $batch->add( $row->namespace, $row->title ); |
69 | | - } |
70 | | - $batch->execute(); |
71 | | - if ( $db->numRows( $res ) > 0 ) { |
72 | | - $db->dataSeek( $res, 0 ); |
73 | | - } |
| 65 | + if ( !$this->isCached() || !$res->numRows() ) { |
| 66 | + return; |
74 | 67 | } |
| 68 | + |
| 69 | + $batch = new LinkBatch(); |
| 70 | + foreach ( $res as $row ) { |
| 71 | + $batch->add( $row->namespace, $row->title ); |
| 72 | + } |
| 73 | + $batch->execute(); |
| 74 | + |
| 75 | + $res->seek( 0 ); |
75 | 76 | } |
76 | 77 | |
77 | 78 | function sortDescending() { |
— | — | @@ -81,23 +82,26 @@ |
82 | 83 | $dm = $this->getLanguage()->getDirMark(); |
83 | 84 | |
84 | 85 | $title = Title::makeTitle( $result->namespace, $result->title ); |
85 | | - if ( !$title ) { |
86 | | - return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->'; |
87 | | - } |
| 86 | + |
88 | 87 | $hlink = Linker::linkKnown( |
89 | 88 | $title, |
90 | | - wfMsgHtml( 'hist' ), |
| 89 | + $this->msg( 'hist' )->escaped(), |
91 | 90 | array(), |
92 | 91 | array( 'action' => 'history' ) |
93 | 92 | ); |
94 | | - $plink = $this->isCached() |
95 | | - ? Linker::link( $title ) |
96 | | - : Linker::linkKnown( $title ); |
| 93 | + $hlinkInParentheses = $this->msg( 'parentheses' )->rawParams( $hlink )->escaped(); |
| 94 | + |
| 95 | + if ( $this->isCached() ) { |
| 96 | + $plink = Linker::link( $title ); |
| 97 | + $exists = $title->exists(); |
| 98 | + } else { |
| 99 | + $plink = Linker::linkKnown( $title ); |
| 100 | + $exists = true; |
| 101 | + } |
| 102 | + |
97 | 103 | $size = $this->msg( 'nbytes' )->numParams( $result->value )->escaped(); |
98 | 104 | |
99 | | - $hlinkInParentheses = $this->msg( 'parentheses' )->rawParams( $hlink )->escaped(); |
100 | | - |
101 | | - return $title->exists() |
| 105 | + return $exists |
102 | 106 | ? "${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]" |
103 | 107 | : "<del>${hlinkInParentheses} {$dm}{$plink} {$dm}[{$size}]</del>"; |
104 | 108 | } |