1
0
Fork 0

Fix other issues with readonly caches, refs #10906

pull/10921/head
Jordi Boggiano 2022-07-01 11:55:43 +02:00
parent f8324e0524
commit c3bb27960b
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
2 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,6 @@
### [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 @putenv scripts receiving arguments passed to the command (#10846)
* Fixed support for spaces in paths with binary proxies on Windows (#10836)

View File

@ -104,7 +104,7 @@ class Cache
|| !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;
}
}
@ -265,7 +265,7 @@ class Cache
*/
public function remove($file)
{
if ($this->isEnabled()) {
if ($this->isEnabled() && !$this->readOnly) {
$file = Preg::replace('{[^'.$this->allowlist.']}i', '-', $file);
if (file_exists($this->root . $file)) {
return $this->filesystem->unlink($this->root . $file);
@ -280,7 +280,7 @@ class Cache
*/
public function clear()
{
if ($this->isEnabled()) {
if ($this->isEnabled() && !$this->readOnly) {
$this->filesystem->emptyDirectory($this->root);
return true;
@ -314,7 +314,7 @@ class Cache
*/
public function gc($ttl, $maxSize)
{
if ($this->isEnabled()) {
if ($this->isEnabled() && !$this->readOnly) {
$expire = new \DateTime();
$expire->modify('-'.$ttl.' seconds');