Added support for custom maintenance templates.
This commit is contained in:
parent
5a15c791c5
commit
9b1feda909
2 changed files with 26 additions and 15 deletions
|
@ -42,16 +42,26 @@ class Controller extends Object
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// @todo Clean this up to be just a single sanity check
|
// @todo Clean this up to be just a single sanity check
|
||||||
if (isset($this->config->pickles['disabled']) && $this->config->pickles['disabled'] == true)
|
if (isset($this->config->pickles['disabled']) && $this->config->pickles['disabled'])
|
||||||
{
|
{
|
||||||
// @todo Add support for custom templates
|
$custom_template = SITE_TEMPLATE_PATH . '__shared/maintenance.phtml';
|
||||||
throw new Exception('
|
|
||||||
<h1>Down for Maintenance</h1>
|
if (file_exists($custom_template))
|
||||||
<p>' . $_SERVER['SERVER_NAME'] . ' is currently down for maintenance. Please check back in a few minutes.</p>
|
{
|
||||||
<p>Additionally, a custom maintenance template was not found.</p>
|
require_once $custom_template;
|
||||||
<hr>
|
}
|
||||||
<em>Powered by <a href="https://github.com/joshtronic/pickles">PICKLES</a></em>
|
else
|
||||||
');
|
{
|
||||||
|
echo '
|
||||||
|
<h1>Down for Maintenance</h1>
|
||||||
|
<p>' . $_SERVER['SERVER_NAME'] . ' is currently down for maintenance. Please check back in a few minutes.</p>
|
||||||
|
<p>Additionally, a custom maintenance template was not found.</p>
|
||||||
|
<hr>
|
||||||
|
<em>Powered by <a href="https://github.com/joshtronic/pickles">PICKLES</a></em>
|
||||||
|
';
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks for attributes passed in the URI
|
// Checks for attributes passed in the URI
|
||||||
|
@ -310,9 +320,6 @@ class Controller extends Object
|
||||||
Profiler::timer('module ' . $default_method);
|
Profiler::timer('module ' . $default_method);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo Set this in the module and use $module->return and rename module->return to module->data?
|
|
||||||
$module->display = ['template', 'json'];
|
|
||||||
|
|
||||||
// Checks if we have any templates
|
// Checks if we have any templates
|
||||||
$parent_template = $module->template;
|
$parent_template = $module->template;
|
||||||
$template_exists = $this->validateTemplates($module, $parent_template);
|
$template_exists = $this->validateTemplates($module, $parent_template);
|
||||||
|
|
|
@ -27,12 +27,16 @@ class ControllerTest extends PHPUnit_Framework_TestCase
|
||||||
new Controller();
|
new Controller();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public function testCustomSiteDown()
|
public function testCustomSiteDown()
|
||||||
{
|
{
|
||||||
$this->fail();
|
$this->config->data['pickles']['disabled'] = true;
|
||||||
|
|
||||||
|
file_put_contents(SITE_TEMPLATE_PATH . '__shared/maintenance.phtml', '<h1>Custom Down for Maintenance</h1>');
|
||||||
|
|
||||||
|
new Controller();
|
||||||
|
|
||||||
|
$this->expectOutputRegex('/<h1>Custom Down for Maintenance<\/h1>/');
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
public function testAttributesInURI()
|
public function testAttributesInURI()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue