From f8bb2ae1f9841e687c4396a8036a06999c87a3e3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 1 Nov 2006 21:02:00 +0000 Subject: [PATCH] * (bug 7780) Fix regression in editing redirects There's still some bugs with the redirect table; for instance it doesn't get cleared on page deletion. --- RELEASE-NOTES | 2 ++ includes/Article.php | 14 ++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 4d4bc3b2b8..37ce5df79d 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -119,6 +119,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Fix for parser tests with MySQL 5 in strict mode * Added block option "enable autoblocks" * Amend Special:Ipblocklist to note when a block has autoblock DISABLED. +* (bug 7780) Fix regression in editing redirects + == Languages updated == diff --git a/includes/Article.php b/includes/Article.php index d5b97c4bfe..4c1eebd25a 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1057,25 +1057,19 @@ class Article { wfProfileIn( __METHOD__ ); - $where = array('rd_from' => $this->getId()); - if ($isRedirect) { // This title is a redirect, Add/Update row in the redirect table $set = array( /* SET */ 'rd_namespace' => $redirectTitle->getNamespace(), - 'rd_title' => $redirectTitle->getDBkey() + 'rd_title' => $redirectTitle->getDBkey(), + 'rd_from' => $this->getId(), ); - $dbw->update( 'redirect', $set, $where, __METHOD__ ); - - if ( $dbw->affectedRows() == 0 ) { - // Update failed, need to insert the row instead - $dbw->insert( 'redirect', array_merge($set, $where), __METHOD__ ); - } + $dbw->replace( 'redirect', array( 'rd_from' ), $set, __METHOD__ ); } else { - // This is not a redirect, remove row from redirect table + $where = array( 'rd_from' => $this->getId() ); $dbw->delete( 'redirect', $where, __METHOD__); } -- 2.20.1