| @@ 79-93 (lines=15) @@ | ||
| 76 | * |
|
| 77 | * @return bool true if success and false if something fails. |
|
| 78 | */ |
|
| 79 | public function setDownMode() |
|
| 80 | { |
|
| 81 | $file = $this->maintenanceFilePath(); |
|
| 82 | ||
| 83 | if (!touch($file)) { |
|
| 84 | $message = sprintf( |
|
| 85 | 'Something went wrong on trying to create maintenance file %s.', |
|
| 86 | $file |
|
| 87 | ); |
|
| 88 | ||
| 89 | throw new Exceptions\FileException($message); |
|
| 90 | } |
|
| 91 | ||
| 92 | return true; |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * Put application in up mode. |
|
| @@ 102-116 (lines=15) @@ | ||
| 99 | * |
|
| 100 | * @return bool true if success and false if something fails. |
|
| 101 | */ |
|
| 102 | public function setUpMode() |
|
| 103 | { |
|
| 104 | $file = $this->maintenanceFilePath(); |
|
| 105 | ||
| 106 | if (file_exists($file) && !unlink($file)) { |
|
| 107 | $message = sprintf( |
|
| 108 | 'Something went wrong on trying to remove maintenance file %s.', |
|
| 109 | $file |
|
| 110 | ); |
|
| 111 | ||
| 112 | throw new Exceptions\FileException($message); |
|
| 113 | } |
|
| 114 | ||
| 115 | return true; |
|
| 116 | } |
|
| 117 | ||
| 118 | public function checkAllowedIp($ip) |
|
| 119 | { |
|