From 085c8f5a43636cbb0c09d7a6cbeb218a8a7128e9 Mon Sep 17 00:00:00 2001 From: Jake Bentvelzen Date: Thu, 8 Dec 2016 21:35:38 +1100 Subject: [PATCH] ENHANCEMENT 2x increase in scanning of files for ConfigManifest --- .../04_Configuration/00_Configuration.md | 4 ++++ src/Core/Manifest/ConfigManifest.php | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md b/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md index 0cfd4bcfe..a97d2489a 100644 --- a/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md +++ b/docs/en/02_Developer_Guides/04_Configuration/00_Configuration.md @@ -165,6 +165,10 @@ pair in the mask is removed ## Configuration YAML Syntax and Rules +
+As of Silverstripe 4, YAML files can no longer be placed any deeper than 2 directories deep. As this was an unintended bug, this change will only affect you if you nest your modules deeper than the top level of your project. +
+ Each module can have a directory immediately underneath the main module directory called `_config/`. Inside this directory you can add YAML files that contain values for the configuration system. diff --git a/src/Core/Manifest/ConfigManifest.php b/src/Core/Manifest/ConfigManifest.php index 6ddf1fec7..ec2986c6b 100644 --- a/src/Core/Manifest/ConfigManifest.php +++ b/src/Core/Manifest/ConfigManifest.php @@ -244,7 +244,9 @@ class ConfigManifest 'min_depth' => 0, 'name_regex' => '/(^|[\/\\\\])_config.php$/', 'ignore_tests' => !$includeTests, - 'file_callback' => array($this, 'addSourceConfigFile') + 'file_callback' => array($this, 'addSourceConfigFile'), + // Cannot be max_depth: 1 due to "/framework/admin/_config.php" + 'max_depth' => 2 )); $finder->find($this->base); @@ -252,7 +254,8 @@ class ConfigManifest $finder->setOptions(array( 'name_regex' => '/\.ya?ml$/', 'ignore_tests' => !$includeTests, - 'file_callback' => array($this, 'addYAMLConfigFile') + 'file_callback' => array($this, 'addYAMLConfigFile'), + 'max_depth' => 2 )); $finder->find($this->base);