statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Caching config breaks filesystems.disks #2407

Closed oniryx closed 5 years ago

oniryx commented 5 years ago

Describe the bug

Running statamic without laravel config cached is working. Caching the config php please config:cache generated an error where the local filesystems couldn't be found

To Reproduce

From a freshly setup statamic on the console do the following

  1. php please
  2. everything is working ok
  3. php please config:cache
  4. php please
  5. See error

Expected behavior

The listing of all the commnands

Screenshots Screenshot 2019-06-07 at 11 54 03

If applicable, add screenshots to help explain your problem.

Environment details (please complete the following information):

Suggested fix

diff --git a/statamic/core/Providers/FilesystemServiceProvider.php b/statamic/core/Providers/FilesystemServiceProvider.php
index 9d92fbc..ac96b31 100644
--- a/statamic/core/Providers/FilesystemServiceProvider.php
+++ b/statamic/core/Providers/FilesystemServiceProvider.php
@@ -332,6 +332,11 @@ class FilesystemServiceProvider extends ServiceProvider
      */
     private function mergeIntoLaravel()
     {
-        $this->config->set('filesystems.disks', $this->disks);
+        $this->config->set('filesystems.disks',
+            array_merge(
+                $this->config->get('filesystems.disks'),
+                $this->disks
+            )
+        );
     }
 }
jackmcdade commented 5 years ago

We don't support caching the config Laravel style - Statamic has it's own caching system. It's not so much a bug as just something you need to know and...not do. 😁