summaryrefslogtreecommitdiffstats
path: root/public.php
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-30 14:48:03 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-30 14:48:03 +0200
commit2e45eb8ad69d8978220e0b3ea4314545cb08fa6f (patch)
tree7f87217a074919e39fdbd40ca5efb315c47804e0 /public.php
parentfa7446d86de1817df38597eeebf2e5803e0c4cdd (diff)
downloadnextcloud-server-2e45eb8ad69d8978220e0b3ea4314545cb08fa6f.tar.gz
nextcloud-server-2e45eb8ad69d8978220e0b3ea4314545cb08fa6f.zip
Return 503 in public.php and OCS API when upgrade is due
To prevent unexpected behavior, public.php and the OCS API calls will return 503 Service Unavailable when an upgrade is due.
Diffstat (limited to 'public.php')
-rw-r--r--public.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/public.php b/public.php
index eed63948112..1f858fd073d 100644
--- a/public.php
+++ b/public.php
@@ -3,6 +3,14 @@
try {
require_once 'lib/base.php';
+ if (\OCP\Util::needUpgrade()) {
+ // since the behavior of apps or remotes are unpredictable during
+ // an upgrade, return a 503 directly
+ OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
+ OC_Template::printErrorPage('Service unavailable');
+ exit;
+ }
+
OC::checkMaintenanceMode();
OC::checkSingleUserMode();
$pathInfo = OC_Request::getPathInfo();