From 9a9a644c5688dd049bc8fad71d0a45feeb0bf979 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov <38059171+askvortsov1@users.noreply.github.com> Date: Wed, 7 Apr 2021 22:13:08 -0400 Subject: [PATCH] Don't fail silently on cache clear (#2756) --- .../core/src/Foundation/Console/CacheClearCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Foundation/Console/CacheClearCommand.php b/framework/core/src/Foundation/Console/CacheClearCommand.php index 85f526022..ae7c3d710 100644 --- a/framework/core/src/Foundation/Console/CacheClearCommand.php +++ b/framework/core/src/Foundation/Console/CacheClearCommand.php @@ -62,7 +62,13 @@ class CacheClearCommand extends AbstractCommand { $this->info('Clearing the cache...'); - $this->cache->flush(); + $succeeded = $this->cache->flush(); + + if (! $succeeded) { + $this->error('Could not clear contents of `storage/cache`. Please adjust file permissions and try again. This can frequently be fixed by clearing cache via the `Tools` dropdown on the Administration Dashboard page.'); + + return 1; + } $storagePath = $this->paths->storage; array_map('unlink', glob($storagePath.'/formatter/*'));