From 726ddc3f40dce4347b436abb36f70408c3e23c1d Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 25 Mar 2009 18:25:29 +0000 Subject: [PATCH] (bug 15814) Filter log chunk at Special:RevisionDelete to selected items --- includes/specials/SpecialRevisiondelete.php | 42 +++++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index ab0112aa88..63c050b6c5 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -113,15 +113,47 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { } else if( $this->deleteKey == 'logid' ) { $this->showLogItems(); } + $qc = $this->getLogQueryCond(); # Show relevant lines from the deletion log $wgOut->addHTML( "

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

\n" ); - LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText() ); + LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', 25, $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() ); + LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', 25, $qc ); } } + + private function getLogQueryCond() { + $ids = $safeIds = array(); + switch( $this->deleteKey ) { + case 'oldid': + $ids = $this->oldids; + break; + case 'artimestamp': + $ids = $this->artimestamps; + break; + case 'oldimage': + $ids = $this->oldimgs; + break; + case 'fileid': + $ids = $this->fileids; + break; + case 'logid': + $ids = $this->logids; + break; + } + // Digit chars only + foreach( $ids as $id ) { + if( preg_match( '/^\d+$/', $id, $m ) ) { + $safeIds[] = $m[0]; + } + } + if( count($safeIds) ) { + return array("log_params RLIKE '".implode('|',$safeIds)."'"); + } + return null; + } private function secureOperation() { global $wgUser; @@ -1497,12 +1529,14 @@ class RevisionDeleter { * @param string $param, URL param * @param Array $items */ - function updateLog( $title, $count, $nbitfield, $obitfield, $comment, $target, $param, $items = array() ) { + function updateLog( $title, $count, $nbitfield, $obitfield, $comment, + $target, $param, $items = array() ) + { // Put things hidden from sysops in the oversight log $logtype = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ? 'suppress' : 'delete'; $log = new LogPage( $logtype ); - $reason = $this->getLogMessage ( $count, $nbitfield, $obitfield, $comment, $param == 'logid' ); + $reason = $this->getLogMessage( $count, $nbitfield, $obitfield, $comment, $param == 'logid' ); if( $param == 'logid' ) { $params = array( implode( ',', $items) ); -- 2.20.1