Index: trunk/phase3/maintenance/deleteRevision.php |
— | — | @@ -63,7 +63,14 @@ |
64 | 64 | $this->output( "Revision $revID not found\n" ); |
65 | 65 | } else { |
66 | 66 | $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__ ); |
67 | 69 | $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 | + } |
68 | 75 | } |
69 | 76 | } |
70 | 77 | $this->output( "Deleted $affected revisions\n" ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -423,7 +423,10 @@ |
424 | 424 | * (bug 20317) Cleaned up default main page link accesskey settings |
425 | 425 | * (bug 20362) Special:Statistics now produces valid HTML when view counters are |
426 | 426 | enabled |
| 427 | +* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks |
| 428 | + target page |
427 | 429 | |
| 430 | + |
428 | 431 | == API changes in 1.16 == |
429 | 432 | |
430 | 433 | * Added uiprop=changeablegroups to meta=userinfo |