| 1 | <?php |
||
| 8 | class MaintenanceModeExtension extends Extension |
||
|
|
|||
| 9 | { |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @throws SS_HTTPResponse_Exception |
||
| 13 | */ |
||
| 14 | public function onBeforeInit() |
||
| 15 | { |
||
| 16 | if($this->isDownForMaintenance()) |
||
| 17 | { |
||
| 18 | $this->respond503(); |
||
| 19 | } |
||
| 20 | } |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @return bool |
||
| 24 | */ |
||
| 25 | public function isDownForMaintenance() |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Somehow $this->owner->httpError puts a burden on de Database. |
||
| 32 | * |
||
| 33 | * Maybe not very Silverstripe'sch, but at least this works |
||
| 34 | */ |
||
| 35 | protected function respond503() |
||
| 51 | |||
| 52 | protected function get503File() |
||
| 62 | |||
| 63 | } |
||
| 64 |
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.