From cb3c802785dd70eb500d881fa5adff2b03e4b988 Mon Sep 17 00:00:00 2001 From: keddyassociates <33474672+keddyassociates@users.noreply.github.com> Date: Wed, 6 Dec 2017 04:45:09 -0500 Subject: [PATCH] Resolve unlink() error Resolves unlink() errors that occur when concurrent requests for a cache file results in one unlink() call being successful while other unlink() calls result in a PHP error being thrown. --- src/xPDO/Cache/xPDOCacheManager.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/xPDO/Cache/xPDOCacheManager.php b/src/xPDO/Cache/xPDOCacheManager.php index 3bf67986..6e90fd48 100644 --- a/src/xPDO/Cache/xPDOCacheManager.php +++ b/src/xPDO/Cache/xPDOCacheManager.php @@ -495,10 +495,12 @@ public function deleteTree($dirname, $options= array('deleteTop' => false, 'skip } elseif (is_file($path)) { if (is_array($extensions) && !empty($extensions) && !$this->endsWith($file, $extensions)) continue; - if (unlink($path)) { - array_push($result, $path); - } else { - $hasMore= true; + if(file_exists($path)){ + if (unlink($path)) { + array_push($result, $path); + } else { + $hasMore= true; + } } } }