Index: trunk/phase3/maintenance/deleteRevision.php |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | array( |
25 | 25 | 'ar_namespace' => 'page_namespace', |
26 | 26 | 'ar_title' => 'page_title', |
| 27 | + 'ar_page_id' => 'page_id', |
27 | 28 | 'ar_comment' => 'rev_comment', |
28 | 29 | 'ar_user' => 'rev_user', |
29 | 30 | 'ar_user_text' => 'rev_user_text', |
— | — | @@ -30,6 +31,8 @@ |
31 | 32 | 'ar_minor_edit' => 'rev_minor_edit', |
32 | 33 | 'ar_rev_id' => 'rev_id', |
33 | 34 | 'ar_text_id' => 'rev_text_id', |
| 35 | + 'ar_deleted' => 'rev_deleted', |
| 36 | + 'ar_len' => 'rev_len', |
34 | 37 | ), array( |
35 | 38 | 'rev_id' => $revID, |
36 | 39 | 'page_id = rev_page' |
— | — | @@ -40,6 +43,13 @@ |
41 | 44 | } else { |
42 | 45 | $affected += $dbw->affectedRows(); |
43 | 46 | $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 | + } |
44 | 54 | } |
45 | 55 | } |
46 | 56 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -310,6 +310,8 @@ |
311 | 311 | * (bug 19839) Comments in log items are no more double escaped |
312 | 312 | * (bug 18161) Fix inconsistent separators in watchlist link toolbars with |
313 | 313 | "enhanced recent changes" |
| 314 | +* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks |
| 315 | + target page |
314 | 316 | |
315 | 317 | == API changes in 1.16 == |
316 | 318 | |