* (bug 7780) Fix regression in editing redirects
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 1 Nov 2006 21:02:00 +0000 (21:02 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 1 Nov 2006 21:02:00 +0000 (21:02 +0000)
There's still some bugs with the redirect table; for instance it doesn't get cleared on page deletion.

RELEASE-NOTES
includes/Article.php

index 4d4bc3b..37ce5df 100644 (file)
@@ -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 ==
 
index d5b97c4..4c1eebd 100644 (file)
@@ -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__);
                        }