remove is_writable check on filesystem cache
This commit is contained in:
parent
73a7169a5d
commit
4dc4f694ca
@ -16,6 +16,7 @@ use Psr\Log\LoggerAwareInterface;
|
|||||||
use Psr\Log\LoggerAwareTrait;
|
use Psr\Log\LoggerAwareTrait;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
use Symfony\Component\Cache\CacheItem;
|
use Symfony\Component\Cache\CacheItem;
|
||||||
|
use Symfony\Component\Cache\Exception\CacheException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
@ -129,6 +130,8 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
|||||||
* @param int $lifetime The lifetime of the cached values, 0 for persisting until manual cleaning
|
* @param int $lifetime The lifetime of the cached values, 0 for persisting until manual cleaning
|
||||||
*
|
*
|
||||||
* @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
* @return array|bool The identifiers that failed to be cached or a boolean stating if caching succeeded or not
|
||||||
|
*
|
||||||
|
* @throws CacheException If write can not be performed
|
||||||
*/
|
*/
|
||||||
abstract protected function doSave(array $values, $lifetime);
|
abstract protected function doSave(array $values, $lifetime);
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Cache\Adapter;
|
namespace Symfony\Component\Cache\Adapter;
|
||||||
|
|
||||||
|
use Symfony\Component\Cache\Exception\CacheException;
|
||||||
use Symfony\Component\Cache\Exception\InvalidArgumentException;
|
use Symfony\Component\Cache\Exception\InvalidArgumentException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -39,9 +40,7 @@ class FilesystemAdapter extends AbstractAdapter
|
|||||||
if (false === $dir = realpath($dir) ?: (file_exists($dir) ? $dir : false)) {
|
if (false === $dir = realpath($dir) ?: (file_exists($dir) ? $dir : false)) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache directory does not exist (%s)', $directory));
|
throw new InvalidArgumentException(sprintf('Cache directory does not exist (%s)', $directory));
|
||||||
}
|
}
|
||||||
if (!is_writable($dir .= DIRECTORY_SEPARATOR)) {
|
$dir .= DIRECTORY_SEPARATOR;
|
||||||
throw new InvalidArgumentException(sprintf('Cache directory is not writable (%s)', $directory));
|
|
||||||
}
|
|
||||||
// On Windows the whole path is limited to 258 chars
|
// On Windows the whole path is limited to 258 chars
|
||||||
if ('\\' === DIRECTORY_SEPARATOR && strlen($dir) > 234) {
|
if ('\\' === DIRECTORY_SEPARATOR && strlen($dir) > 234) {
|
||||||
throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory));
|
throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory));
|
||||||
@ -141,6 +140,10 @@ class FilesystemAdapter extends AbstractAdapter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$ok && !is_writable($this->directory)) {
|
||||||
|
throw new CacheException(sprintf('Cache directory is not writable (%s)', $this->directory));
|
||||||
|
}
|
||||||
|
|
||||||
return $ok;
|
return $ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user