From: Ryan Schmidt Date: Fri, 30 Jul 2010 19:56:49 +0000 (+0000) Subject: * (bug 24425) Use Database::replace instead of delete/insert in SqlBagOStuff::set... X-Git-Tag: 1.31.0-rc.0~35824 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=1de99b0247f7ed0960c06b7b83158c567ab26c5c;p=lhc%2Fweb%2Fwiklou.git * (bug 24425) Use Database::replace instead of delete/insert in SqlBagOStuff::set to avoid query errors about duplicate keynames. --- 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 ) ),