r49149 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49148‎ | r49149 | r49150 >
Date:12:58, 3 April 2009
Author:aaron
Status:ok
Tags:
Comment:
RevisionDelete log extract query optimizations
Modified paths:
  • /trunk/phase3/includes/LogEventsList.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/LogEventsList.php
@@ -365,7 +365,9 @@
366366 $del = ''; // No one should be hiding from the oversight log
367367 } else {
368368 $target = SpecialPage::getTitleFor( 'Log', $row->log_type );
369 - $query = array( 'target' => $target->getPrefixedDBkey(), 'logid' => $row->log_id );
 369+ $page = Title::makeTitle( $row->log_namespace, $row->log_title );
 370+ $query = array( 'target' => $target->getPrefixedDBkey(),
 371+ 'logid' => $row->log_id, 'page' => $page->getPrefixedDBkey() );
370372 $del = $this->skin->revDeleteLink( $query,
371373 self::isDeleted( $row, LogPage::DELETED_RESTRICTED ) );
372374 }
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -49,6 +49,7 @@
5050 return;
5151 }
5252 $this->page = Title::newFromUrl( $this->target );
 53+ $this->contextPage = Title::newFromUrl( $wgRequest->getText( 'page' ) );
5354 # If we have revisions, get the title from the first one
5455 # since they should all be from the same page. This allows
5556 # for more flexibility with page moves...
@@ -146,6 +147,19 @@
147148 $safeIds[] = $m[0];
148149 }
149150 }
 151+ // Optimization for logs
 152+ 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+ }
 163+ }
150164 // Format is <id1,id2,i3...>
151165 if( count($safeIds) ) {
152166 $conds[] = "log_params RLIKE '(^|\n|,)(".implode('|',$safeIds).")(,|$)'";
@@ -548,7 +562,8 @@
549563 Xml::submitButton( wfMsg( 'revdelete-submit' ) ) );
550564 $hidden = array(
551565 Xml::hidden( 'wpEditToken', $wgUser->editToken() ),
552 - Xml::hidden( 'target', $this->page->getPrefixedText() ),
 566+ Xml::hidden( 'target', $this->page->getPrefixedDBKey() ),
 567+ Xml::hidden( 'page', $this->contextPage ? $this->contextPage->getPrefixedDBKey() : '' ),
553568 Xml::hidden( 'type', $this->deleteKey ),
554569 Xml::hidden( 'logid', implode(',',$this->logids) )
555570 );

Follow-up revisions

RevisionCommit summaryAuthorDate
r49152Tweak/fixes to r49149aaron13:46, 3 April 2009
r49153Correct empty case for r49149aaron13:49, 3 April 2009

Status & tagging log