viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]

Add to Query Info the name of cache file used, if using a FileCache, a=chris

Chris Pollett [2016-02-11 16:Feb:th]
Add to Query Info the name of cache file used, if using a FileCache, a=chris
Filename
src/library/FileCache.php
src/models/PhraseModel.php
diff --git a/src/library/FileCache.php b/src/library/FileCache.php
index 594fddf25..f619311bf 100644
--- a/src/library/FileCache.php
+++ b/src/library/FileCache.php
@@ -41,6 +41,11 @@ require_once __DIR__."/../configs/Config.php";
  */
 class FileCache
 {
+    /**
+     * File used to serve last cache request
+     * @var string
+     */
+    public $cache_file;
     /**
      * Folder name to use for this FileCache
      * @var string
@@ -81,9 +86,10 @@ class FileCache
     public function get($key)
     {
         $checksum_block = $this->checksum($key);
-        $cache_file = $this->dir_name."/$checksum_block/".webencode($key);
-        if (file_exists($cache_file)) {
-            return unserialize(file_get_contents($cache_file));
+        $this->cache_file = $this->dir_name . "/$checksum_block/" .
+            webencode($key);
+        if (file_exists($this->cache_file)) {
+            return unserialize(file_get_contents($this->cache_file));
         }
         return false;
     }
diff --git a/src/models/PhraseModel.php b/src/models/PhraseModel.php
index 57e63fb80..8989a2bd2 100755
--- a/src/models/PhraseModel.php
+++ b/src/models/PhraseModel.php
@@ -326,6 +326,11 @@ class PhraseModel extends ParallelModel
                 if (C\QUERY_STATISTICS) {
                     $this->query_info['QUERY'] .=
                         "$in2<b>Parse done by Cache Lookup</b><br />";
+                    if (!empty(self::$cache->cache_file) ) {
+                        $this->query_info['QUERY'] .=
+                            "$in2<b>Cache File Used: </b>" .
+                            self::$cache->cache_file . "<br />";
+                    }
                 }
             }
             if ($cache_results) {
@@ -1138,6 +1143,11 @@ class PhraseModel extends ParallelModel
                     $this->query_info['QUERY'] .=
                         "$in2<b>Cache Lookup Time</b>: ".
                         L\changeInMicrotime($lookup_time)."<br />";
+                    if (!empty(self::$cache->cache_file) ) {
+                        $this->query_info['QUERY'] .=
+                            "$in2<b>Cache File Used:</b> " .
+                            self::$cache->cache_file . "<br />";
+                    }
                 }
                 if ($results !== false) {
                     return $results;
ViewGit