aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metastrings.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 09:28:56 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 09:28:56 +0000
commit719df1b09331472ed7c42b364f5fd3e1413147d7 (patch)
treebfdffb263200754bccf9f75d9893cbb00604a4da /engine/lib/metastrings.php
parent6abb350a17931f139f3d4571e4c5a5fa4b0b1005 (diff)
downloadelgg-719df1b09331472ed7c42b364f5fd3e1413147d7.tar.gz
elgg-719df1b09331472ed7c42b364f5fd3e1413147d7.tar.bz2
Refs #86 - Better debug
git-svn-id: https://code.elgg.org/elgg/trunk@1159 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metastrings.php')
-rw-r--r--engine/lib/metastrings.php22
1 files changed, 17 insertions, 5 deletions
diff --git a/engine/lib/metastrings.php b/engine/lib/metastrings.php
index 5a91905e4..3b0fba2e7 100644
--- a/engine/lib/metastrings.php
+++ b/engine/lib/metastrings.php
@@ -26,14 +26,20 @@
$string = sanitise_string($string);
$result = array_search($string, $METASTRINGS_CACHE);
- if ($result!==false)
+ if ($result!==false) {
+
+ if ($CONFIG->debug)
+ error_log("Returning id for string:$string from cache.");
+
return $result;
+ }
$row = get_data_row("SELECT * from {$CONFIG->dbprefix}metastrings where string='$string' limit 1");
if ($row) {
$METASTRINGS_CACHE[$row->id] = $row->string; // Cache it
+
if ($CONFIG->debug)
- error_log("Returning id for string {$row->string} from cache.");
+ error_log("Cacheing {$row->string}");
return $row->id;
}
@@ -53,14 +59,20 @@
$id = (int) $id;
- if (isset($METASTRINGS_CACHE[$id]))
- return $METASTRINGS_CACHE[$id];
+ if (isset($METASTRINGS_CACHE[$id])) {
+
+ if ($CONFIG->debug)
+ error_log("Returning string for id:$id from cache.");
+
+ return $METASTRINGS_CACHE[$id];
+ }
$row = get_data_row("SELECT * from {$CONFIG->dbprefix}metastrings where id='$id' limit 1");
if ($row) {
$METASTRINGS_CACHE[$id] = $row->string; // Cache it
+
if ($CONFIG->debug)
- error_log("Returning string {$row->string} from cache.");
+ error_log("Cacheing {$row->string}");
return $row->string;
}