r48839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48838‎ | r48839 | r48840 >
Date:18:25, 25 March 2009
Author:aaron
Status:resolved (Comments)
Tags:
Comment:
(bug 15814) Filter log chunk at Special:RevisionDelete to selected items
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -113,15 +113,47 @@
114114 } else if( $this->deleteKey == 'logid' ) {
115115 $this->showLogItems();
116116 }
 117+ $qc = $this->getLogQueryCond();
117118 # Show relevant lines from the deletion log
118119 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
119 - LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText() );
 120+ LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', 25, $qc );
120121 # Show relevant lines from the suppression log
121122 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
122123 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
123 - LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText() );
 124+ LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', 25, $qc );
124125 }
125126 }
 127+
 128+ private function getLogQueryCond() {
 129+ $ids = $safeIds = array();
 130+ switch( $this->deleteKey ) {
 131+ case 'oldid':
 132+ $ids = $this->oldids;
 133+ break;
 134+ case 'artimestamp':
 135+ $ids = $this->artimestamps;
 136+ break;
 137+ case 'oldimage':
 138+ $ids = $this->oldimgs;
 139+ break;
 140+ case 'fileid':
 141+ $ids = $this->fileids;
 142+ break;
 143+ case 'logid':
 144+ $ids = $this->logids;
 145+ break;
 146+ }
 147+ // Digit chars only
 148+ foreach( $ids as $id ) {
 149+ if( preg_match( '/^\d+$/', $id, $m ) ) {
 150+ $safeIds[] = $m[0];
 151+ }
 152+ }
 153+ if( count($safeIds) ) {
 154+ return array("log_params RLIKE '".implode('|',$safeIds)."'");
 155+ }
 156+ return null;
 157+ }
126158
127159 private function secureOperation() {
128160 global $wgUser;
@@ -1497,12 +1529,14 @@
14981530 * @param string $param, URL param
14991531 * @param Array $items
15001532 */
1501 - function updateLog( $title, $count, $nbitfield, $obitfield, $comment, $target, $param, $items = array() ) {
 1533+ function updateLog( $title, $count, $nbitfield, $obitfield, $comment,
 1534+ $target, $param, $items = array() )
 1535+ {
15021536 // Put things hidden from sysops in the oversight log
15031537 $logtype = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ? 'suppress' : 'delete';
15041538 $log = new LogPage( $logtype );
15051539
1506 - $reason = $this->getLogMessage ( $count, $nbitfield, $obitfield, $comment, $param == 'logid' );
 1540+ $reason = $this->getLogMessage( $count, $nbitfield, $obitfield, $comment, $param == 'logid' );
15071541
15081542 if( $param == 'logid' ) {
15091543 $params = array( implode( ',', $items) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r48843* Changes to r48839...aaron20:05, 25 March 2009
r48888Fix for r48839: log deletion uses a different actionaaron17:02, 26 March 2009
r50567[schema change] Use new log_search table to replace ugly code from r48839. Ma...aaron22:03, 13 May 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r43283Add proposed patch to:...aaron21:33, 7 November 2008

Comments

#Comment by Aaron Schulz (talk | contribs)   16:30, 26 March 2009

Tweaked in r48885 to filter by action as it should. Should also make query easy.

#Comment by Brion VIBBER (talk | contribs)   23:16, 15 April 2009

Please check to make sure this doesn't break the query planning... RLIKE looks pretty nasty.

It's also non-standard. Is it available in PostgreSQL and other DB backends?

#Comment by Aaron Schulz (talk | contribs)   04:30, 19 April 2009

Don't think it is on PG. Planning should be OK.

I've already got the code to replace all this rlike stuff with log_search table usage though :)

#Comment by Aaron Schulz (talk | contribs)   22:31, 13 May 2009

Totally redone in r50567

Status & tagging log