From 175f3e3f0e63fd22f2a8b02f1ac9132e3b955b77 Mon Sep 17 00:00:00 2001 From: Djamil Legato Date: Thu, 25 Aug 2016 13:47:14 -0700 Subject: [PATCH] Added `override` and `force` options for Streams setup --- CHANGELOG.md | 1 + system/src/Grav/Common/Config/Setup.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53f4670e8..4946d3736 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Added new `tmp` folder at root. Accessible via stream `tmp://`. Can be cleared with `bin/grav clear --tmp-only` as well as `--all`. * Added support for RTL in `LanguageCodes` so you can determine if a language is RTL or not * Ability to set `custom_base_url` in system configuration + * Added `override` and `force` options for Streams setup 1. [](#improved) * Important vendor updates to provide PHP 7.1 beta support! * Added a `Util::arrayFlatten()` static function diff --git a/system/src/Grav/Common/Config/Setup.php b/system/src/Grav/Common/Config/Setup.php index 8bc8cc53e..26ff3321f 100644 --- a/system/src/Grav/Common/Config/Setup.php +++ b/system/src/Grav/Common/Config/Setup.php @@ -91,12 +91,14 @@ class Setup extends Data ], 'backup' => [ 'type' => 'Stream', + 'force' => true, 'prefixes' => [ '' => ['backup'] ] ], 'tmp' => [ 'type' => 'Stream', + 'force' => true, 'prefixes' => [ '' => ['tmp'] ] @@ -200,9 +202,13 @@ class Setup extends Data if (isset($config['paths'])) { $locator->addPath($scheme, '', $config['paths']); } + + $override = isset($config['override']) ? $config['override'] : false; + $force = isset($config['force']) ? $config['force'] : false; + if (isset($config['prefixes'])) { foreach ($config['prefixes'] as $prefix => $paths) { - $locator->addPath($scheme, $prefix, $paths); + $locator->addPath($scheme, $prefix, $paths, $override, $force); } } }