-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't get this module to work #36
Comments
I've noticed the error page static file issue; The reason is that it only writes to the static file on publish, and only if it doesn't exist yet (i.e. it won't overwrite an outdated static file). In a ChangeSet, if a page has no changes, ErrorPage::publishSingle() is never called, and no static page is written. This means saving an unchanged page in the CMS doesn't publish this file. /**
* When an error page is published, create a static HTML page with its
* content, so the page can be shown even when SilverStripe is not
* functioning correctly before publishing this page normally.
*
* @return bool True if published
*/
public function publishSingle()
{
if (!parent::publishSingle()) {
return false;
}
return $this->writeStaticPage();
} A second issue is during dev/build, the static page is only written if missing (never updated). // Ensure this page has cached error content
$success = true;
if (!$page->hasStaticPage()) {
// Update static content
$success = $page->writeStaticPage();
} elseif ($pageExists) {
// If page exists and already has content, no alteration_message is displayed
return;
} My fix is to override requireDefaultRecords() and implement a custom static builder. /**
* @throws ValidationException
*/
public function requireDefaultRecords()
{
parent::requireDefaultRecords();
$this->buildErrorPage();
} full gist https://gist.github.com/tractorcow/2145af6cdedd6f8d3c9a8f5f46e2bf7d |
Thank you. Can we fix this properly in the module? I am happy to make a pull request. |
@sunnysideup still keen to provide a PR? |
This module seems to be fundamentally broken.
You can replicate it like this:
go to https://demo.silverstripe.org/admin/pages/
add the following to the about page
HTMLField
using the source code editor:https://user-images.githubusercontent.com/167154/67129986-93143980-f25c-11e9-8240-ec5bba6e7411.png
https://user-images.githubusercontent.com/167154/67130278-49781e80-f25d-11e9-9a85-bce96d0b72d4.png
As you can see the Error does not look anything like it is supposed to.
I have found the same issue on my own sites. When I save the Error Page, it does not write to the assets folder.
The text was updated successfully, but these errors were encountered: