X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fclasses%2Fcachesystem.class.php;h=6a1992dd9d371e5145304a1a3ad7473df0a69a54;hp=61a6fe31458002ceeb7b05dd936df47e39297add;hb=ab82613b0100336c0966a742c986874ec1692672;hpb=06d97fddd5c72e2b1c14ddb855b7eddc53f169a7 diff --git a/inc/classes/cachesystem.class.php b/inc/classes/cachesystem.class.php index 61a6fe3145..6a1992dd9d 100644 --- a/inc/classes/cachesystem.class.php +++ b/inc/classes/cachesystem.class.php @@ -115,8 +115,7 @@ class CacheSystem { // This will destory an existing cache file! if ($this->ret == $this->statusDone) { // Mark it as no longer readable - unset($this->readable[$this->name]); - unset($GLOBALS['file_readable'][$this->fqfn]); + $this->markCacheAsUnreadable(); // Create file if ($this->isCacheReadable()) changeMode($this->fqfn, 0666); @@ -130,6 +129,12 @@ class CacheSystem { } } + // Mark the cache as unreadable + function markCacheAsUnreadable () { + unset($this->readable[$this->name]); + unset($GLOBALS['file_readable'][$this->fqfn]); + } + function addRow ($data) { // Is the pointe rvalid? if (is_resource($this->pointer)) { @@ -217,11 +222,17 @@ class CacheSystem { } else { // Cache file not found or not readable addFatalMessage(__METHOD__, __LINE__, "(".__LINE__."): ".sprintf(getMessage('CACHE_CANNOT_LOAD'), $this->fqfn)); + + // Try to remove it + $this->removeCacheFile(); } } // Destroy an existing cache file function removeCacheFile ($removeArray = false, $force = false) { + // Remove cached value of readable cache + $this->markCacheAsUnreadable(); + // Debug message /* DEBUG: */ logDebugMessage(__METHOD__, __LINE__, sprintf("%s should be removed.", $this->name)); @@ -251,9 +262,6 @@ class CacheSystem { // Remove cache file from system removeFile($this->fqfn); - // No longer readable! - unset($this->readable[$this->name]); - // Shall we remove the array from memory? if ($removeArray === true) { // Debug message if allowed