Merge pull request #7061 from jonom/errorpage-separation

Removed ErrorPage
This commit is contained in:
Ingo Schommer 2017-06-27 14:00:43 +12:00 committed by GitHub
commit daed8cb056
3 changed files with 5 additions and 44 deletions

View File

@ -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.

View File

@ -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`

View File

@ -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;