From ec49c2a27547f63c329aa1bb8bf35656723f3ac7 Mon Sep 17 00:00:00 2001 From: Rotem Liss Date: Sat, 9 Feb 2008 12:40:02 +0000 Subject: [PATCH] Basic compatibility between tables: When deleting the old redirect (when moving over redirect), deleting its links records and revisions. --- includes/SpecialMovepage.php | 2 +- includes/Title.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/includes/SpecialMovepage.php b/includes/SpecialMovepage.php index 7a003bbb2e..6bbe496c03 100644 --- a/includes/SpecialMovepage.php +++ b/includes/SpecialMovepage.php @@ -276,7 +276,7 @@ class MovePageForm { '&newtitle=' . wfUrlencode( $nt->getPrefixedText() ) . '&talkmoved='.$talkmoved ); - $wgOut->redirect( $success ); + #$wgOut->redirect( $success ); } function showSuccess() { diff --git a/includes/Title.php b/includes/Title.php index decf6e7ab7..ad7cc54300 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -2465,6 +2465,19 @@ class Title { # We have to remove it so that the next step doesn't trigger # a conflict on the unique namespace+title index... $dbw->delete( 'page', array( 'page_id' => $newid ), $fname ); + if ( !$dbw->cascadingDeletes() ) { + $dbw->delete( 'revision', array( 'rev_page' => $newid ), __METHOD__ ); + global $wgUseTrackbacks; + if ($wgUseTrackbacks) + $dbw->delete( 'trackbacks', array( 'tb_page' => $newid ), __METHOD__ ); + $dbw->delete( 'pagelinks', array( 'pl_from' => $newid ), __METHOD__ ); + $dbw->delete( 'imagelinks', array( 'il_from' => $newid ), __METHOD__ ); + $dbw->delete( 'categorylinks', array( 'cl_from' => $newid ), __METHOD__ ); + $dbw->delete( 'templatelinks', array( 'tl_from' => $newid ), __METHOD__ ); + $dbw->delete( 'externallinks', array( 'el_from' => $newid ), __METHOD__ ); + $dbw->delete( 'langlinks', array( 'll_from' => $newid ), __METHOD__ ); + $dbw->delete( 'redirect', array( 'rd_from' => $newid ), __METHOD__ ); + } # Save a null revision in the page's history notifying of the move $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true ); -- 2.20.1