From: Hypolite Petovan Date: Mon, 17 Oct 2016 20:54:22 +0000 (-0400) Subject: Improve performance of settings save by not querying the DB if submitted value is... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=62bd32c1acefa5b8fb8c3261a304332308adbd9c;p=friendica.git Improve performance of settings save by not querying the DB if submitted value is the same --- 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);