From d0da319004ca782b55606ff85ff6c383deaf8002 Mon Sep 17 00:00:00 2001 From: Jonathon Menz Date: Mon, 12 Jun 2017 17:59:11 -0700 Subject: [PATCH] Removed ErrorPage Removed references to ErrorPage so it can be split off in to a separate module. (#4149) --- .../01_Tutorials/01_Building_A_Basic_Site.md | 2 +- docs/en/04_Changelogs/4.0.0.md | 45 ++----------------- tests/php/Control/RequestHandlingTest.php | 2 +- 3 files changed, 5 insertions(+), 44 deletions(-) diff --git a/docs/en/01_Tutorials/01_Building_A_Basic_Site.md b/docs/en/01_Tutorials/01_Building_A_Basic_Site.md index 37c37d4ab..3050be6a4 100644 --- a/docs/en/01_Tutorials/01_Building_A_Basic_Site.md +++ b/docs/en/01_Tutorials/01_Building_A_Basic_Site.md @@ -71,7 +71,7 @@ should see the CMS interface with a list of the pages currently on your website ### Try it -There are three pages already created for you - "Home", "About Us" and "Contact Us", as well as a 404 error page. Experiment +There are three pages already created for you - "Home", "About Us" and "Contact Us". Experiment with the editor - try different formatting, tables and images. When you are done, click "Save Draft" or "Save & Publish" to post the content to the live site. diff --git a/docs/en/04_Changelogs/4.0.0.md b/docs/en/04_Changelogs/4.0.0.md index 5cd8e6240..06e03f145 100644 --- a/docs/en/04_Changelogs/4.0.0.md +++ b/docs/en/04_Changelogs/4.0.0.md @@ -883,46 +883,9 @@ public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null) } ``` -#### Upgrade code that modifies the behaviour of ErrorPage +#### Install the ErrorPage module -ErrorPage has been updated to use a configurable asset backend, similar to the `AssetStore` described above. -This replaces the `ErrorPage.static_filepath` config that was used to write local files. - -As a result, error pages may be cached either to a local filesystem, or an external Flysystem store -(which is configured via setting a new Flysystem backend with YAML). - -`ErrorPage::get_filepath_for_errorcode()` has been removed, because the local path for a specific code is -no longer assumed. Instead you should use `ErrorPage::get_content_for_errorcode` which retrieves the -appropriate content for that error using one of the methods above. - -In order to retrieve the actual filename (which is used to identify an error page regardless of base -path), you can use `ErrorPage::get_error_filename()` instead. Unlike the old `get_filepath_for_errorcode` -method, there is no $locale parameter. - -In case that user code must customise this filename, such as for extensions which provide a locale value -for any error page, the extension point `updateErrorFilename` can be used. This extension point should -also be used to replace any `alternateFilepathForErrorcode` used. - -```php -class MyErrorPageExtension extends SiteTreeExtension -{ - public function updateErrorFilename(&$name, &$statuscode) - { - if ($this->owner->exists()) { - $locale = $this->Locale; - } else { - $locale = Translatable::get_current_locale(); - } - $name = "error-{$statusCode}-{$locale}.html"; - } -} -``` - -```yml -ErrorPage: - extensions: - - MyErrorPageExtension -``` +ErrorPage has been moved to a separate module to allow for alternative approaches to managing error responses. Please install [silverstripe/errorpage](http://addons.silverstripe.org/add-ons/silverstripe/errorpage) to preserve the 3.x functionality. #### Upgrading asset web.config, .htaccess, or other server configuration @@ -1420,9 +1383,7 @@ After (`mysite/_config/config.yml`): * Removed `SapphireTest::skipTest()`, use `markTestSkipped()` in a `setUp()` method instead * Removed the `History.js` javascript library. * `debugmethods` querystring argument has been removed from debugging. -* `ErrorPage.static_filepath` config has been removed. -* `ErrorPage::get_filepath_for_errorcode` has been removed -* `ErrorPage::alternateFilepathForErrorcode` extension point has been removed +* Moved `ErrorPage` into a new module: [silverstripe/errorpage](http://addons.silverstripe.org/add-ons/silverstripe/errorpage). See upgrading notes in that module. * Removed `VirtualPage_Controller`. Virtual pages will now share whichever controller the “target” page uses * Removed `Config_LRU` * Removed `SilverStripeInjectionCreator` diff --git a/tests/php/Control/RequestHandlingTest.php b/tests/php/Control/RequestHandlingTest.php index 1433ca4c2..1ac668602 100644 --- a/tests/php/Control/RequestHandlingTest.php +++ b/tests/php/Control/RequestHandlingTest.php @@ -3,7 +3,7 @@ namespace SilverStripe\Control\Tests; use SilverStripe\Admin\LeftAndMain; -use SilverStripe\CMS\Controllers\ErrorPageControllerExtension; +use SilverStripe\ErrorPage\ErrorPageControllerExtension; use SilverStripe\Control\Controller; use SilverStripe\Control\Tests\RequestHandlingTest\AllowedController; use SilverStripe\Control\Tests\RequestHandlingTest\ControllerFormWithAllowedActions;