Redo r53641, reverted in r55457, now using indexed queries:
* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks target page
This commit is contained in:
parent
579090b822
commit
9ed6ba2461
2 changed files with 10 additions and 0 deletions
|
|
@ -423,6 +423,9 @@ this. Was used when mwEmbed was going to be an extension.
|
|||
* (bug 20317) Cleaned up default main page link accesskey settings
|
||||
* (bug 20362) Special:Statistics now produces valid HTML when view counters are
|
||||
enabled
|
||||
* (bug 19857) maintenance/deleteRevision.php on last revision no longer breaks
|
||||
target page
|
||||
|
||||
|
||||
== API changes in 1.16 ==
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,14 @@ class DeleteRevision extends Maintenance {
|
|||
$this->output( "Revision $revID not found\n" );
|
||||
} else {
|
||||
$affected += $dbw->affectedRows();
|
||||
$pageID = $dbw->selectField( 'revision', 'rev_page', array( 'rev_id' => $revID ), __METHOD__ );
|
||||
$pageLatest = $dbw->selectField( 'page', 'page_latest', array( 'page_id' => $pageID ), __METHOD__ );
|
||||
$dbw->delete( 'revision', array( 'rev_id' => $revID ) );
|
||||
if ( $pageLatest == $revID ) {
|
||||
// Database integrity
|
||||
$newLatest = $dbw->selectField( 'revision', 'rev_id', array( 'rev_page' => $pageID ), __METHOD__, array( 'ORDER BY' => 'rev_timestamp DESC' ) );
|
||||
$dbw->update( 'page', array( 'page_latest' => $newLatest ), array( 'page_id' => $pageID ), __METHOD__ );
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->output( "Deleted $affected revisions\n" );
|
||||
|
|
|
|||
Loading…
Reference in a new issue