X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=app%2FWeb.php;h=b7bc23ceea1456fed244bb786a02e5a142081a62;hb=26bbafd451da564adc2eb302db679bd4f4eecac5;hp=0353a996c2b75e97a9a653c9495395a1684ce458;hpb=b0a2ea11d6b820abe4758aaf56e6d226ded72942;p=pharext%2Fpharext.org diff --git a/app/Web.php b/app/Web.php index 0353a99..b7bc23c 100644 --- a/app/Web.php +++ b/app/Web.php @@ -24,27 +24,31 @@ class Web } function __invoke(Dispatcher $dispatcher) { - $route = $dispatcher->dispatch($this->request->getRequestMethod(), - $this->baseUrl->pathinfo($this->request->getRequestUrl())); - - switch ($route[0]) { - case Dispatcher::NOT_FOUND: - $this->display(404, null, 404); - break; - - case Dispatcher::METHOD_NOT_ALLOWED: - $this->display(405, null, 405, ["Allowed" => $route[1]]); - break; - - case Dispatcher::FOUND: - list(, $handler, $args) = $route; - try { - $handler(array_map("urldecode", $args)); - } catch (\Exception $exception) { - self::cleanBuffers(); - $this->display(500, compact("exception"), 500, ["X-Exception", get_class($exception)]); - } - break; + if (!file_exists("../config/maintenance")) { + $route = $dispatcher->dispatch($this->request->getRequestMethod(), + $this->baseUrl->pathinfo($this->request->getRequestUrl())); + + switch ($route[0]) { + case Dispatcher::NOT_FOUND: + $this->display(404, null, 404); + break; + + case Dispatcher::METHOD_NOT_ALLOWED: + $this->display(405, null, 405, ["Allowed" => $route[1]]); + break; + + case Dispatcher::FOUND: + list(, $handler, $args) = $route; + try { + $handler(array_map("urldecode", $args)); + } catch (\Exception $exception) { + self::cleanBuffers(); + $this->display(500, compact("exception"), 500, ["X-Exception", get_class($exception)]); + } + break; + } + } else { + $this->display(503, null, 503); } $this->response->send();