aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorPaweł Sroka <srokap@gmail.com>2012-11-04 04:39:50 +0100
committerSteve Clay <steve@mrclay.org>2012-11-27 23:15:56 -0500
commit2f0c5900465d3e12467cc5154394c44b6712759c (patch)
tree5970ef6270abe623bd6e8e6f162961f77e44a28d /engine/lib
parent04e73aa6428eb792bedbbd616891de52eed3dcbf (diff)
downloadelgg-2f0c5900465d3e12467cc5154394c44b6712759c.tar.gz
elgg-2f0c5900465d3e12467cc5154394c44b6712759c.tar.bz2
Don't hit DB on elgg_get_config after putting all configuration into local object
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/configuration.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/engine/lib/configuration.php b/engine/lib/configuration.php
index 305aa00b6..540312481 100644
--- a/engine/lib/configuration.php
+++ b/engine/lib/configuration.php
@@ -95,11 +95,14 @@ function elgg_get_config($name, $site_guid = 0) {
// installation wide setting
$value = datalist_get($name);
} else {
- // site specific setting
- if ($site_guid == 0) {
- $site_guid = (int) $CONFIG->site_id;
+ // hit DB only if we're not sure if value exists or not
+ if (!isset($CONFIG->site_config_loaded)) {
+ // site specific setting
+ if ($site_guid == 0) {
+ $site_guid = (int) $CONFIG->site_id;
+ }
+ $value = get_config($name, $site_guid);
}
- $value = get_config($name, $site_guid);
}
if ($value !== false) {
@@ -558,6 +561,8 @@ function _elgg_load_site_config() {
$CONFIG->url = $CONFIG->wwwroot;
get_all_config();
+ // gives hint to elgg_get_config function how to approach missing values
+ $CONFIG->site_config_loaded = true;
}
/**