From 005f94f205215d96f41ad199953a0a4059e78315 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 3 Apr 2009 13:46:04 +0000 Subject: [PATCH] Tweak/fixes to r49149 --- includes/specials/SpecialRevisiondelete.php | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 65a9f4fe3c..790df7105b 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -83,14 +83,14 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } else if( $this->deleteKey == 'logid' ) { $this->showLogItems(); } - $qc = $this->getLogQueryCond(); + list($qc,$lim) = $this->getLogQueryCond(); # Show relevant lines from the deletion log $wgOut->addHTML( "

" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "

\n" ); - LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', 25, $qc ); + LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', $lim, $qc ); # Show relevant lines from the suppression log if( $wgUser->isAllowed( 'suppressionlog' ) ) { $wgOut->addHTML( "

" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "

\n" ); - LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', 25, $qc ); + LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', $lim, $qc ); } } @@ -119,6 +119,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { private function getLogQueryCond() { $ids = $safeIds = array(); $action = 'revision'; + $limit = 25; // default switch( $this->deleteKey ) { case 'oldid': $ids = $this->oldids; @@ -140,7 +141,8 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { // Revision delete logs $conds = array( 'log_action' => $action ); // Just get the whole log if there are a lot if items - if( count($ids) > 20 ) return $conds; + if( count($ids) > $limit ) + return array($conds,$limit); // Digit chars only foreach( $ids as $id ) { if( preg_match( '/^\d+$/', $id, $m ) ) { @@ -149,22 +151,20 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } // Optimization for logs if( $action == 'event' ) { - # If a context page is given, use title,time index - if( $this->contextPage ) { - $conds['log_namespace'] = $this->contextPage->getNamespace(); - $conds['log_title'] = $this->contextPage->getDBKey(); - } else { - $first = wfGetDB( DB_SLAVE )->selectField( 'logging', - 'MIN(log_timestamp)', array('log_id' => $safeIds) ); - # The event was be hidden after it was made - $conds[] = "log_timestamp >= {$first}"; // use type,time index - } + $dbr = wfGetDB( DB_SLAVE ); + # Get the timestamp of the first item + $first = $dbr->selectField( 'logging', 'log_timestamp', + array('log_id' => $safeIds), __METHOD__, array('ORDER BY' => 'log_id') ); + # If there are no items, then stop here + if( $first == false ) $conds = '1 = 0'; + # The event was be hidden after it was made + $conds[] = 'log_timestamp > '.$dbr->addQuotes($first); // type,time index } // Format is if( count($safeIds) ) { $conds[] = "log_params RLIKE '(^|\n|,)(".implode('|',$safeIds).")(,|$)'"; } - return $conds; + return array($conds,$limit); } private function secureOperation() { -- 2.20.1