Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php |
— | — | @@ -83,14 +83,14 @@ |
84 | 84 | } else if( $this->deleteKey == 'logid' ) { |
85 | 85 | $this->showLogItems(); |
86 | 86 | } |
87 | | - $qc = $this->getLogQueryCond(); |
| 87 | + list($qc,$lim) = $this->getLogQueryCond(); |
88 | 88 | # Show relevant lines from the deletion log |
89 | 89 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
90 | | - LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', 25, $qc ); |
| 90 | + LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', $lim, $qc ); |
91 | 91 | # Show relevant lines from the suppression log |
92 | 92 | if( $wgUser->isAllowed( 'suppressionlog' ) ) { |
93 | 93 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" ); |
94 | | - LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', 25, $qc ); |
| 94 | + LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', $lim, $qc ); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
— | — | @@ -119,6 +119,7 @@ |
120 | 120 | private function getLogQueryCond() { |
121 | 121 | $ids = $safeIds = array(); |
122 | 122 | $action = 'revision'; |
| 123 | + $limit = 25; // default |
123 | 124 | switch( $this->deleteKey ) { |
124 | 125 | case 'oldid': |
125 | 126 | $ids = $this->oldids; |
— | — | @@ -140,7 +141,8 @@ |
141 | 142 | // Revision delete logs |
142 | 143 | $conds = array( 'log_action' => $action ); |
143 | 144 | // Just get the whole log if there are a lot if items |
144 | | - if( count($ids) > 20 ) return $conds; |
| 145 | + if( count($ids) > $limit ) |
| 146 | + return array($conds,$limit); |
145 | 147 | // Digit chars only |
146 | 148 | foreach( $ids as $id ) { |
147 | 149 | if( preg_match( '/^\d+$/', $id, $m ) ) { |
— | — | @@ -149,22 +151,20 @@ |
150 | 152 | } |
151 | 153 | // Optimization for logs |
152 | 154 | if( $action == 'event' ) { |
153 | | - # If a context page is given, use title,time index |
154 | | - if( $this->contextPage ) { |
155 | | - $conds['log_namespace'] = $this->contextPage->getNamespace(); |
156 | | - $conds['log_title'] = $this->contextPage->getDBKey(); |
157 | | - } else { |
158 | | - $first = wfGetDB( DB_SLAVE )->selectField( 'logging', |
159 | | - 'MIN(log_timestamp)', array('log_id' => $safeIds) ); |
160 | | - # The event was be hidden after it was made |
161 | | - $conds[] = "log_timestamp >= {$first}"; // use type,time index |
162 | | - } |
| 155 | + $dbr = wfGetDB( DB_SLAVE ); |
| 156 | + # Get the timestamp of the first item |
| 157 | + $first = $dbr->selectField( 'logging', 'log_timestamp', |
| 158 | + array('log_id' => $safeIds), __METHOD__, array('ORDER BY' => 'log_id') ); |
| 159 | + # If there are no items, then stop here |
| 160 | + if( $first == false ) $conds = '1 = 0'; |
| 161 | + # The event was be hidden after it was made |
| 162 | + $conds[] = 'log_timestamp > '.$dbr->addQuotes($first); // type,time index |
163 | 163 | } |
164 | 164 | // Format is <id1,id2,i3...> |
165 | 165 | if( count($safeIds) ) { |
166 | 166 | $conds[] = "log_params RLIKE '(^|\n|,)(".implode('|',$safeIds).")(,|$)'"; |
167 | 167 | } |
168 | | - return $conds; |
| 168 | + return array($conds,$limit); |
169 | 169 | } |
170 | 170 | |
171 | 171 | private function secureOperation() { |