summaryrefslogtreecommitdiff
path: root/includes/bootstrap.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-05-25 21:01:30 +0000
committerDries Buytaert <dries@buytaert.net>2007-05-25 21:01:30 +0000
commit1f864214976463f31fcf3645cb9ab4934c54d72c (patch)
tree493638137f664654be0928954d6bc2b9fe0f2b73 /includes/bootstrap.inc
parent633540ef8c7e2a2300caa18f27db6954423a93b2 (diff)
downloadbrdo-1f864214976463f31fcf3645cb9ab4934c54d72c.tar.gz
brdo-1f864214976463f31fcf3645cb9ab4934c54d72c.tar.bz2
- Patch #55516 by David Strauss et al: removed some database locking.
Diffstat (limited to 'includes/bootstrap.inc')
-rw-r--r--includes/bootstrap.inc9
1 files changed, 5 insertions, 4 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index d3c35b5f2..a394a7c75 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -444,10 +444,11 @@ function variable_get($name, $default) {
function variable_set($name, $value) {
global $conf;
- db_lock_table('variable');
- db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
- db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
- db_unlock_tables();
+ $serialized_value = serialize($value);
+ db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'", $serialized_value, $name);
+ if (!db_affected_rows()) {
+ @db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, $serialized_value);
+ }
cache_clear_all('variables', 'cache');