aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}