From 1de99b0247f7ed0960c06b7b83158c567ab26c5c Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Fri, 30 Jul 2010 19:56:49 +0000 Subject: [PATCH] * (bug 24425) Use Database::replace instead of delete/insert in SqlBagOStuff::set to avoid query errors about duplicate keynames. --- RELEASE-NOTES | 2 ++ includes/BagOStuff.php | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index f55d9a9178..e2748d0081 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -258,6 +258,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN useful error message. * Uploading to a protected title will allow the user to choose a new name instead of showing an error page +* (bug 24425) Use Database::replace instead of delete/insert in SqlBagOStuff::set + to avoid query errors about duplicate keynames. === API changes in 1.17 === * (bug 22738) Allow filtering by action type on query=logevent. diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php index fb57ad023c..2e2ba01855 100644 --- a/includes/BagOStuff.php +++ b/includes/BagOStuff.php @@ -307,8 +307,9 @@ class SqlBagOStuff extends BagOStuff { } try { $db->begin(); - $db->delete( 'objectcache', array( 'keyname' => $key ), __METHOD__ ); - $db->insert( 'objectcache', + // (bug 24425) use a replace if the db supports it instead of + // delete/insert to avoid clashes with conflicting keynames + $db->replace( 'objectcache', array( 'keyname' ), array( 'keyname' => $key, 'value' => $db->encodeBlob( $this->serialize( $value ) ), -- 2.20.1