r53641 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53640‎ | r53641 | r53642 >
Date:10:34, 22 July 2009
Author:ialex
Status:reverted
Tags:
Comment:
* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks target page
* also copy ar_page_id, ar_len and ar_deleted fields when deleting a revision
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/maintenance/deleteRevision.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/deleteRevision.php
@@ -23,6 +23,7 @@
2424 array(
2525 'ar_namespace' => 'page_namespace',
2626 'ar_title' => 'page_title',
 27+ 'ar_page_id' => 'page_id',
2728 'ar_comment' => 'rev_comment',
2829 'ar_user' => 'rev_user',
2930 'ar_user_text' => 'rev_user_text',
@@ -30,6 +31,8 @@
3132 'ar_minor_edit' => 'rev_minor_edit',
3233 'ar_rev_id' => 'rev_id',
3334 'ar_text_id' => 'rev_text_id',
 35+ 'ar_deleted' => 'rev_deleted',
 36+ 'ar_len' => 'rev_len',
3437 ), array(
3538 'rev_id' => $revID,
3639 'page_id = rev_page'
@@ -40,6 +43,13 @@
4144 } else {
4245 $affected += $dbw->affectedRows();
4346 $dbw->delete( 'revision', array( 'rev_id' => $revID ) );
 47+
 48+ // Database integrity
 49+ $pageID = $dbw->selectField( 'page', 'page_id', array( 'page_latest' => $revID ), __METHOD__ );
 50+ if ( $pageID ) {
 51+ $newLatest = $dbw->selectField( 'revision', 'rev_id', array( 'rev_page' => $pageID ), __METHOD__, array( 'ORDER BY' => 'rev_timestamp DESC' ) );
 52+ $dbw->update( 'page', array( 'page_latest' => $newLatest ), array( 'page_id' => $pageID ), __METHOD__ );
 53+ }
4454 }
4555 }
4656
Index: trunk/phase3/RELEASE-NOTES
@@ -310,6 +310,8 @@
311311 * (bug 19839) Comments in log items are no more double escaped
312312 * (bug 18161) Fix inconsistent separators in watchlist link toolbars with
313313 "enhanced recent changes"
 314+* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks
 315+ target page
314316
315317 == API changes in 1.16 ==
316318

Follow-up revisions

RevisionCommit summaryAuthorDate
r55457Partial revert of r53641 "* (bug 19857) maintenance/deleteRevision.php on las...brion22:51, 21 August 2009
r55523Redo r53641, reverted in r55457, now using indexed queries:...ialex09:39, 23 August 2009

Status & tagging log