From 64af679c35b135fcd5940bd8aa9a609e86f66f1a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 30 Aug 2017 08:35:41 +1200 Subject: [PATCH 1/2] DOCS Corrected env type docs (fixes #7290) --- .../01_Installation/05_Common_Problems.md | 10 ++-------- .../07_Debugging/00_Environment_Types.md | 16 +--------------- docs/en/04_Changelogs/4.0.0.md | 4 +++- src/Control/Director.php | 12 ------------ 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/docs/en/00_Getting_Started/01_Installation/05_Common_Problems.md b/docs/en/00_Getting_Started/01_Installation/05_Common_Problems.md index ff9a1cd6a..5fc5f5110 100644 --- a/docs/en/00_Getting_Started/01_Installation/05_Common_Problems.md +++ b/docs/en/00_Getting_Started/01_Installation/05_Common_Problems.md @@ -12,14 +12,8 @@ detailed error messages for security reasons. You'll typically need to get your information. If you can log-in to the CMS as an administrator, append `?isDev=1` to any URL to temporarily set your browsing session into -"dev mode". If you can't log-in in the first place because of the error, add this directive to your `mysite/_config/config.yml` -(don't forget to remove it afterwards!): - -```yml - Director: - # temporary debugging statement - environment_type: 'dev' -``` +"dev mode". If you can't log-in in the first place because of the error, please +configure an `SS_ENVIRONMENT_TYPE` through [environment-management] (don't forget to remove it afterwards!).
On "live" environments, the `?isDev=1` solution is preferred, as it means that your other visitors don't see ugly diff --git a/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md b/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md index d8a537a04..132e36963 100644 --- a/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md +++ b/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md @@ -4,22 +4,8 @@ summary: Configure your SilverStripe environment to define how your web applicat # Environment Types SilverStripe knows three different environment types (or "modes"). Each of the modes gives you different tools -and behaviors. The environment is managed either through a [YML configuration file](../configuration) or in a +and behaviors. The environment is managed either through an [environment configuration file](../../getting_started/environment_management). - -The definition of setting an environment type in a `mysite/_config/app.yml` looks like - - -```yml - - SilverStripe\Control\Director: - environment_type: 'dev' -``` - -The definition of setting an environment type in a `.env` file looks like -``` - SS_ENVIRONMENT_TYPE="dev" -``` The three environment types you can set are `dev`, `test` and `live`. ### Dev diff --git a/docs/en/04_Changelogs/4.0.0.md b/docs/en/04_Changelogs/4.0.0.md index dd7a8af17..c7d907f8e 100644 --- a/docs/en/04_Changelogs/4.0.0.md +++ b/docs/en/04_Changelogs/4.0.0.md @@ -1797,9 +1797,11 @@ that it belongs to, e.g. `themes/mytheme/templates/MyVendor/Foobar/Model/MyModel All static methods have been removed, and the `inst_` prefix removed from all instance members. Please see the upgrading section on Session object for more details. * `Director.rules` config no longer support `redirect:` directly via config. -* `Director::get_environment_type()` and `Director::set_environment_type()` are removed. +* `Director::get_environment_type()` and `Director::set_environment_type()` are removed. Get the `Kernel` instance via injector and query `getEnvironment()` instead. E.g. `$type = Injector::inst()->get(Kernel::class)->getEnvironment();`. +* The environment can no longer be configured via YAML (`Director.environment_type`). + Use a [.env file](/getting_started/environment_management) to manage environment settings. * Many global methods have been refactored into `Environment` or `Convert` class. * `increase_xdebug_nesting_level_to` removed (functionality has been inlined into `AppKernel`) * `set_increase_time_limit_max` moved to `Environment::setTimeLimitMax()` diff --git a/src/Control/Director.php b/src/Control/Director.php index 90d73807b..109135cf1 100644 --- a/src/Control/Director.php +++ b/src/Control/Director.php @@ -22,12 +22,8 @@ use SilverStripe\View\TemplateGlobalProvider; * The most important part of director is {@link Director::handleRequest()}, which is passed an HTTPRequest and will * execute the appropriate controller. * - * Director also has a number of static methods that provide information about the environment, such as - * {@link Director::$environment_type}. - * * @see Director::handleRequest() * @see Director::$rules - * @see Director::$environment_type * @skipUpgrade */ class Director implements TemplateGlobalProvider @@ -98,14 +94,6 @@ class Director implements TemplateGlobalProvider */ private static $default_base_url = '`SS_BASE_URL`'; - /** - * Assigned environment type - * - * @internal - * @var string - */ - protected static $environment_type; - public function __construct() { } From 02c1a5199b67d6d036fee1de82cec3b40209d6c3 Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Wed, 30 Aug 2017 10:41:01 +1200 Subject: [PATCH 2/2] Docs tweaked sentence wording to be more descriptive --- .../en/02_Developer_Guides/07_Debugging/00_Environment_Types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md b/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md index 132e36963..cd2c251a9 100644 --- a/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md +++ b/docs/en/02_Developer_Guides/07_Debugging/00_Environment_Types.md @@ -4,7 +4,7 @@ summary: Configure your SilverStripe environment to define how your web applicat # Environment Types SilverStripe knows three different environment types (or "modes"). Each of the modes gives you different tools -and behaviors. The environment is managed either through an +and behaviors. The environment is managed by the `SS_ENVIRONMENT_TYPE` variable through an [environment configuration file](../../getting_started/environment_management). The three environment types you can set are `dev`, `test` and `live`.