From 62bd32c1acefa5b8fb8c3261a304332308adbd9c Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 17 Oct 2016 16:54:22 -0400 Subject: [PATCH] Improve performance of settings save by not querying the DB if submitted value is the same --- include/Core/Config.php | 4 ++++ include/Core/PConfig.php | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/include/Core/Config.php b/include/Core/Config.php index bc2bc1fad7..46972e1eb7 100644 --- a/include/Core/Config.php +++ b/include/Core/Config.php @@ -126,6 +126,10 @@ class Config { public static function set($family, $key, $value) { global $a; + if (self::get($family, $key) === $value) { + return true; + } + $a->config[$family][$key] = $value; // manage array value diff --git a/include/Core/PConfig.php b/include/Core/PConfig.php index c6821a2667..1d0f7fc82c 100644 --- a/include/Core/PConfig.php +++ b/include/Core/PConfig.php @@ -123,6 +123,10 @@ class PConfig { global $a; + if (self::get($uid, $family, $key) === $value) { + return true; + } + // manage array value $dbvalue = (is_array($value)?serialize($value):$value); -- 2.39.5