skip to Main Content

When I try to clear the cache from Manager or from a snippet on MODX3.0.2, MODX does not empty the folders under core/cache/resource/ and the cache won’t be cleared.

I traced the problem to xPDOFileCache.php:

public function delete($key, $options= array()) {
    $deleted= false;
    if ($this->getOption(xPDO::OPT_CACHE_MULTIPLE_OBJECT_DELETE, $options, false)) { 
        $cacheKey= $this->getCacheKey($key, array_merge($options, array('cache_ext' => '')));
        if (file_exists($cacheKey) && is_dir($cacheKey)) {
            $results = $this->xpdo->cacheManager->deleteTree($cacheKey, array_merge(array('deleteTop' => false, 'skipDirs' => false, 'extensions' => array('.cache.php')), $options));
            if ($results !== false) {
                $deleted = true;
            }
        }
    }
    $cacheKey= $this->getCacheKey($key, $options);
    if (file_exists($cacheKey)) {
        $deleted= @ unlink($cacheKey);
    }
    return $deleted;
}

If condition on line 3 returns false so deleteTree won’t be executed and the folder won’t be emptied. Could someone tell me, what is that condition about and why it returns false? Is it something related to my installation?

2

Answers


  1. Chosen as BEST ANSWER

    Turning the cache_resource_clear_partial setting off is a workaround.

    The original reason for the problem is probably a bug which has been reported on GitHub now.


  2. Quick answer: as far as I remember this behavior depends on some system setting, I’ll let you know shortly

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search