X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FCacheLogPlugin.php;h=4c47de80eb904157eb3f785f90b572427d775062;hb=ba8a24073fc3d545fdc86b613d32b4bfc33743c3;hp=9eb04641e6b2ba24e1c77e300b449e47feb1388b;hpb=1053abd2e8db40505483e1798ceabec77fe93126;p=quix0rs-gnu-social.git diff --git a/plugins/CacheLogPlugin.php b/plugins/CacheLogPlugin.php index 9eb04641e6..4c47de80eb 100644 --- a/plugins/CacheLogPlugin.php +++ b/plugins/CacheLogPlugin.php @@ -61,7 +61,7 @@ class CacheLogPlugin extends Plugin function onEndCacheGet($key, &$value) { - if (is_null($value)) { + if ($value === false) { $this->log(LOG_INFO, "Cache MISS for key '$key'"); } else { $this->log(LOG_INFO, "Cache HIT for key '$key'"); @@ -71,7 +71,21 @@ class CacheLogPlugin extends Plugin function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success) { - $this->log(LOG_INFO, "Setting cache value for key '$key'"); + if (empty($value)) { + if (is_array($value)) { + $this->log(LOG_INFO, "Setting empty array for key '$key'"); + } else if (is_null($value)) { + $this->log(LOG_INFO, "Setting null value for key '$key'"); + } else if (is_string($value)) { + $this->log(LOG_INFO, "Setting empty string for key '$key'"); + } else if (is_integer($value)) { + $this->log(LOG_INFO, "Setting integer 0 for key '$key'"); + } else { + $this->log(LOG_INFO, "Setting empty value '$value' for key '$key'"); + } + } else { + $this->log(LOG_INFO, "Setting non-empty value for key '$key'"); + } return true; } @@ -92,5 +106,16 @@ class CacheLogPlugin extends Plugin $this->log(LOG_INFO, "Done deleting cache value for key '$key'"); return true; } + + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'CacheLog', + 'version' => STATUSNET_VERSION, + 'author' => 'Evan Prodromou', + 'homepage' => 'http://status.net/wiki/Plugin:CacheLog', + 'description' => + _m('Log reads and writes to the cache')); + return true; + } }