Fix other issues with readonly caches, refs #10906
parent
f8324e0524
commit
c3bb27960b
|
@ -1,6 +1,6 @@
|
||||||
### [2.2.15] 2022-07-01
|
### [2.2.15] 2022-07-01
|
||||||
|
|
||||||
* Fixed support for read-only caches where the filesystem is not writable (#10906)
|
* Fixed support for `cache-read-only` where the filesystem is not writable (#10906)
|
||||||
* Fixed type error when using `allow-plugins: true` (#10909)
|
* Fixed type error when using `allow-plugins: true` (#10909)
|
||||||
* Fixed @putenv scripts receiving arguments passed to the command (#10846)
|
* Fixed @putenv scripts receiving arguments passed to the command (#10846)
|
||||||
* Fixed support for spaces in paths with binary proxies on Windows (#10836)
|
* Fixed support for spaces in paths with binary proxies on Windows (#10836)
|
||||||
|
|
|
@ -104,7 +104,7 @@ class Cache
|
||||||
|| !is_writable($this->root)
|
|| !is_writable($this->root)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
|
$this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache. See also cache-read-only config if your filesystem is read-only.</warning>');
|
||||||
$this->enabled = false;
|
$this->enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ class Cache
|
||||||
*/
|
*/
|
||||||
public function remove($file)
|
public function remove($file)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled() && !$this->readOnly) {
|
||||||
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
|
||||||
if (file_exists($this->root . $file)) {
|
if (file_exists($this->root . $file)) {
|
||||||
return $this->filesystem->unlink($this->root . $file);
|
return $this->filesystem->unlink($this->root . $file);
|
||||||
|
@ -280,7 +280,7 @@ class Cache
|
||||||
*/
|
*/
|
||||||
public function clear()
|
public function clear()
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled() && !$this->readOnly) {
|
||||||
$this->filesystem->emptyDirectory($this->root);
|
$this->filesystem->emptyDirectory($this->root);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -314,7 +314,7 @@ class Cache
|
||||||
*/
|
*/
|
||||||
public function gc($ttl, $maxSize)
|
public function gc($ttl, $maxSize)
|
||||||
{
|
{
|
||||||
if ($this->isEnabled()) {
|
if ($this->isEnabled() && !$this->readOnly) {
|
||||||
$expire = new \DateTime();
|
$expire = new \DateTime();
|
||||||
$expire->modify('-'.$ttl.' seconds');
|
$expire->modify('-'.$ttl.' seconds');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue