[Pkg-owncloud-commits] [owncloud] 140/273: Return 503 in public.php and OCS API when upgrade is due

David Prévot taffit at moszumanska.debian.org
Fri Jul 4 03:13:09 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 2e45eb8ad69d8978220e0b3ea4314545cb08fa6f
Author: Vincent Petry <pvince81 at owncloud.com>
Date:   Mon Jun 30 14:48:03 2014 +0200

    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.
---
 ocs/v1.php | 8 ++++++++
 public.php | 8 ++++++++
 2 files changed, 16 insertions(+)

diff --git a/ocs/v1.php b/ocs/v1.php
index d69904f..624355a 100644
--- a/ocs/v1.php
+++ b/ocs/v1.php
@@ -23,6 +23,14 @@
 
 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;
+}
+
 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
 
diff --git a/public.php b/public.php
index eed6394..1f858fd 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();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list