@@ -156,23 +156,25 @@ private function getEnvPath()
156
156
private function disableAllCacheTypes ()
157
157
{
158
158
$ envPath = $ this ->getEnvPath ();
159
- $ envData = include $ envPath ;
159
+ if ($ this ->write ->isWritable ($ this ->write ->getRelativePath ($ envPath ))) {
160
+ $ envData = include $ envPath ;
160
161
161
- if (isset ($ envData ['cache_types ' ])) {
162
- $ cacheTypes = array_keys ($ envData ['cache_types ' ]);
162
+ if (isset ($ envData ['cache_types ' ])) {
163
+ $ cacheTypes = array_keys ($ envData ['cache_types ' ]);
163
164
164
- foreach ($ cacheTypes as $ cacheType ) {
165
- $ envData ['cache_types ' ][$ cacheType ] = 0 ;
166
- }
165
+ foreach ($ cacheTypes as $ cacheType ) {
166
+ $ envData ['cache_types ' ][$ cacheType ] = 0 ;
167
+ }
167
168
168
- $ formatter = new PhpFormatter ();
169
- $ contents = $ formatter ->format ($ envData );
169
+ $ formatter = new PhpFormatter ();
170
+ $ contents = $ formatter ->format ($ envData );
170
171
171
- $ this ->write ->writeFile ($ this ->write ->getRelativePath ($ envPath ), $ contents );
172
- if (function_exists ('opcache_invalidate ' )) {
173
- opcache_invalidate (
174
- $ this ->write ->getAbsolutePath ($ envPath )
175
- );
172
+ $ this ->write ->writeFile ($ this ->write ->getRelativePath ($ envPath ), $ contents );
173
+ if (function_exists ('opcache_invalidate ' )) {
174
+ opcache_invalidate (
175
+ $ this ->write ->getAbsolutePath ($ envPath )
176
+ );
177
+ }
176
178
}
177
179
}
178
180
}
0 commit comments