r49743 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49742‎ | r49743 | r49744 >
Date:00:52, 23 April 2009
Author:aaron
Status:ok
Tags:
Comment:
revert code from r49742 accidentally committed
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -85,15 +85,16 @@
8686 $this->showImages();
8787 } else if( $this->deleteKey == 'logid' ) {
8888 $this->showLogItems();
 89+ return; // no logs for now
8990 }
90 - $qc = $this->getLogQueryCond();
 91+ list($qc,$lim) = $this->getLogQueryCond();
9192 # Show relevant lines from the deletion log
9293 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
93 - LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', 25, $qc );
 94+ LogEventsList::showLogExtract( $wgOut, 'delete', $this->page->getPrefixedText(), '', $lim, $qc );
9495 # Show relevant lines from the suppression log
9596 if( $wgUser->isAllowed( 'suppressionlog' ) ) {
9697 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
97 - LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', 25, $qc );
 98+ LogEventsList::showLogExtract( $wgOut, 'suppress', $this->page->getPrefixedText(), '', $lim, $qc );
9899 }
99100 }
100101
@@ -120,7 +121,9 @@
121122 }
122123
123124 private function getLogQueryCond() {
124 - $logAction = 'revision';
 125+ $ids = $safeIds = array();
 126+ $limit = 25; // default
 127+ $conds = array( 'log_action' => 'revision' ); // revision delete logs
125128 switch( $this->deleteKey ) {
126129 case 'oldid':
127130 $ids = $this->oldids;
@@ -134,19 +137,25 @@
135138 case 'fileid':
136139 $ids = $this->fileids;
137140 break;
138 - case 'logid':
139 - $ids = $this->logids;
140 - $logAction = 'event';
141 - break;
142141 default: // bad type?
143 - return array();
 142+ return array($conds,$limit);
144143 }
145 - // Revision delete logs for these item
146 - $conds = array( 'log_action' => $logAction );
147 - $conds['ls_field'] = RevisionDeleter::getRelationType( $this->deleteKey );
148 - $conds['ls_value'] = $ids;
149 - $conds[] = 'log_id = ls_log_id';
150 - return $conds;
 144+ // Just get the whole log if there are a lot if items
 145+ if( count($ids) > $limit )
 146+ return array($conds,$limit);
 147+ // Digit chars only
 148+ foreach( $ids as $id ) {
 149+ if( preg_match( '/^\d+$/', $id, $m ) ) {
 150+ $safeIds[] = $m[0];
 151+ }
 152+ }
 153+ // Format is <id1,id2,i3...>
 154+ if( count($safeIds) ) {
 155+ $conds[] = "log_params RLIKE '^{$this->deleteKey}.*(^|\n|,)(".implode('|',$safeIds).")(,|\n|$)'";
 156+ } else {
 157+ $conds = array('1=0');
 158+ }
 159+ return array($conds,$limit);
151160 }
152161
153162 private function secureOperation() {
@@ -1532,41 +1541,18 @@
15331542 $param, $items = array() )
15341543 {
15351544 // Put things hidden from sysops in the oversight log
1536 - $logType = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ?
 1545+ $logtype = ( ($nbitfield | $obitfield) & Revision::DELETED_RESTRICTED ) ?
15371546 'suppress' : 'delete';
1538 - // Log deletions show with a difference action message
1539 - $logAction = ( $param == 'logid' ) ? 'event' : 'revision';
1540 - // Track what items changed here
 1547+ $log = new LogPage( $logtype );
15411548 $itemCSV = implode(',',$items);
1542 - // Add params for effected page and ids
 1549+
15431550 if( $param == 'logid' ) {
15441551 $params = array( $itemCSV, "ofield={$obitfield}", "nfield={$nbitfield}" );
 1552+ $log->addEntry( 'event', $title, $comment, $params );
15451553 } else {
 1554+ // Add params for effected page and ids
15461555 $params = array( $param, $itemCSV, "ofield={$obitfield}", "nfield={$nbitfield}" );
 1556+ $log->addEntry( 'revision', $title, $comment, $params );
15471557 }
1548 - // Actually add the deletion log entry
1549 - $log = new LogPage( $logType );
1550 - $logid = $log->addEntry( $logAction, $title, $comment, $params );
1551 - // Allow for easy searching of deletion log items for revision/log items
1552 - $log->addRelations( self::getRelationType($param), $items, $logid );
15531558 }
1554 -
1555 - // Get DB field name for URL param...
1556 - // Future code for other things may also track
1557 - // other types of revision-specific changes.
1558 - public static function getRelationType( $param ) {
1559 - switch( $param ) {
1560 - case 'oldid':
1561 - return 'rev_id';
1562 - case 'artimestamp':
1563 - return 'rev_timestamp';
1564 - case 'oldimage':
1565 - return 'oi_timestamp';
1566 - case 'fileid':
1567 - return 'file_id';
1568 - case 'logid':
1569 - return 'log_id';
1570 - }
1571 - throw new MWException( "Bad log URL param type!" );
1572 - }
15731559 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49742Change for bug 18383, suppress user/talk page on user suppressionaaron00:50, 23 April 2009

Status & tagging log