for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Class MaintenanceModeExtension.
*
* throw a 503 if mysite/down exists
* @property Controller $owner
*/
class MaintenanceModeExtension extends Extension
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
* @throws SS_HTTPResponse_Exception
public function onBeforeInit()
if($this->isDownForMaintenance())
$this->throw503();
}
* @return bool
public function isDownForMaintenance()
return file_exists(BASE_PATH.'/mysite/down');
* Somehow $this->owner->httpError keeps the website spinning.
* Maybe not very Silverstripe'sch, but at least this works
protected function throw503()
$message = 'Website is down for maintenance';
$errorFile = $this->get503File();
$content = is_file($errorFile) ? file_get_contents($errorFile) : '<h1>'.$message.'</h1>';
throw new SS_HTTPResponse_Exception(new SS_HTTPResponse($content, 503, $message));
* @return string
protected function get503File()
$custom = BASE_PATH.(string)Config::inst()->get('MaintenanceMode', 'file');
return is_file($custom) ? $custom : BASE_PATH.'/assets/error-503.html';
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.