r55523 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55522‎ | r55523 | r55524 >
Date:09:39, 23 August 2009
Author:ialex
Status:ok
Tags:
Comment:
Redo r53641, reverted in r55457, now using indexed queries:
* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks target page
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/deleteRevision.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/deleteRevision.php
@@ -63,7 +63,14 @@
6464 $this->output( "Revision $revID not found\n" );
6565 } else {
6666 $affected += $dbw->affectedRows();
 67+ $pageID = $dbw->selectField( 'revision', 'rev_page', array( 'rev_id' => $revID ), __METHOD__ );
 68+ $pageLatest = $dbw->selectField( 'page', 'page_latest', array( 'page_id' => $pageID ), __METHOD__ );
6769 $dbw->delete( 'revision', array( 'rev_id' => $revID ) );
 70+ if ( $pageLatest == $revID ) {
 71+ // Database integrity
 72+ $newLatest = $dbw->selectField( 'revision', 'rev_id', array( 'rev_page' => $pageID ), __METHOD__, array( 'ORDER BY' => 'rev_timestamp DESC' ) );
 73+ $dbw->update( 'page', array( 'page_latest' => $newLatest ), array( 'page_id' => $pageID ), __METHOD__ );
 74+ }
6875 }
6976 }
7077 $this->output( "Deleted $affected revisions\n" );
Index: trunk/phase3/RELEASE-NOTES
@@ -423,7 +423,10 @@
424424 * (bug 20317) Cleaned up default main page link accesskey settings
425425 * (bug 20362) Special:Statistics now produces valid HTML when view counters are
426426 enabled
 427+* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks
 428+ target page
427429
 430+
428431 == API changes in 1.16 ==
429432
430433 * Added uiprop=changeablegroups to meta=userinfo

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53641* (bug 19857) maintenance/deleteRevision.php on last revision no longer break...ialex10:34, 22 July 2009
r55457Partial revert of r53641 "* (bug 19857) maintenance/deleteRevision.php on las...brion22:51, 21 August 2009

Status & tagging log