/** * Deletes single cache entry * * @param string $path Cache path, eg. /sandbox * * @return bool * @throws \InvalidArgumentException Invalid cache patch specified. Patch which doesn't not exist but it's valid * will not cause this exception. */ public function deleteEntry($path) { if (DIRECTORY_SEPARATOR !== '/') { //Path will always have / (bcs it's http path), no matter on which OS $path = str_replace('/', DIRECTORY_SEPARATOR, $path); //...but filesystem differ } $filePath = $path . DIRECTORY_SEPARATOR . 'index.html'; //File path if (!$this->finder->isReadable($filePath)) { return false; } if (!$this->finder->deleteFile($filePath)) { return false; } $this->finder->deleteDirectory($path); //This one can fail - if you try to delete entry /sandbox and url /sandbox/test is present /sandbox directory cannot be deleted return true; }