aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/lib/configuration.php19
1 files changed, 11 insertions, 8 deletions
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index cbc083bd0..b756d2e70 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -282,8 +282,8 @@ function datalist_set($name, $value) {
return false;
}
- $name = sanitise_string($name);
- $value = sanitise_string($value);
+ $sanitised_name = sanitise_string($name);
+ $sanitised_value = sanitise_string($value);
// If memcache is available then invalidate the cached copy
static $datalist_memcache;
@@ -295,13 +295,16 @@ function datalist_set($name, $value) {
$datalist_memcache->delete($name);
}
- insert_data("INSERT into {$CONFIG->dbprefix}datalists"
- . " set name = '{$name}', value = '{$value}'"
- . " ON DUPLICATE KEY UPDATE value='{$value}'");
-
- $DATALIST_CACHE[$name] = $value;
+ $success = insert_data("INSERT into {$CONFIG->dbprefix}datalists"
+ . " set name = '{$sanitised_name}', value = '{$sanitised_value}'"
+ . " ON DUPLICATE KEY UPDATE value='{$sanitised_value}'");
- return true;
+ if ($success) {
+ $DATALIST_CACHE[$name] = $value;
+ return true;
+ } else {
+ return false;
+ }
}
/**