aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-17 08:29:01 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-17 08:29:01 +0000
commit5d1eaa1f741e817e48f1b2e2fc22d40ad04b8e16 (patch)
tree84ed15a2eaabc3d6cad89b0d0035d3de89638ae2 /engine/lib
parent59274adc20aa0dcb88d9bc410c42b785cde0d3f9 (diff)
downloadelgg-5d1eaa1f741e817e48f1b2e2fc22d40ad04b8e16.tar.gz
elgg-5d1eaa1f741e817e48f1b2e2fc22d40ad04b8e16.tar.bz2
Closes #785: datalists now pulls all settings on first item load.
git-svn-id: https://code.elgg.org/elgg/trunk@2775 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php22
1 files changed, 20 insertions, 2 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index c89ab2789..9d677a483 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1690,14 +1690,32 @@
if ($datalist_memcache) $value = $datalist_memcache->load($name);
if ($value) return $value;
- if ($row = get_data_row("SELECT value from {$CONFIG->dbprefix}datalists where name = '{$name}' limit 1")) {
+ // [Marcus Povey 20090217 : Now retrieving all datalist values on first load as this saves about 9 queries per page]
+ $result = get_data("SELECT * from {$CONFIG->dbprefix}datalists");
+ if ($result)
+ {
+ foreach ($result as $row)
+ {
+ $DATALIST_CACHE[$row->name] = $row->value;
+
+ // Cache it if memcache is available
+ if ($datalist_memcache) $datalist_memcache->save($name, $row->value);
+ }
+
+ if (isset($DATALIST_CACHE[$name]))
+ return $DATALIST_CACHE[$name];
+ }
+
+
+ /*if ($row = get_data_row("SELECT value from {$CONFIG->dbprefix}datalists where name = '{$name}' limit 1")) {
$DATALIST_CACHE[$name] = $row->value;
// Cache it if memcache is available
if ($datalist_memcache) $datalist_memcache->save($name, $row->value);
return $row->value;
- }
+ }*/
+
return false;
}