From b619ff6076f200e2aee62758e1e3ea95df1c4a63 Mon Sep 17 00:00:00 2001
From: Vincent Petry <pvince81@owncloud.com>
Date: Fri, 14 Mar 2014 13:58:34 +0100
Subject: [PATCH] Return 503 when a config/data dir error exists

---
 lib/base.php             | 1 +
 lib/private/response.php | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/lib/base.php b/lib/base.php
index 86ee534982..5f15189b11 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -536,6 +536,7 @@ class OC {
 					echo $error['hint'] . "\n\n";
 				}
 			} else {
+				OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
 				OC_Template::printGuestPage('', 'error', array('errors' => $errors));
 			}
 			exit;
diff --git a/lib/private/response.php b/lib/private/response.php
index 71c538fb31..983c682bf3 100644
--- a/lib/private/response.php
+++ b/lib/private/response.php
@@ -12,6 +12,7 @@ class OC_Response {
 	const STATUS_TEMPORARY_REDIRECT = 307;
 	const STATUS_NOT_FOUND = 404;
 	const STATUS_INTERNAL_SERVER_ERROR = 500;
+	const STATUS_SERVICE_UNAVAILABLE = 503;
 
 	/**
 	* @brief Enable response caching by sending correct HTTP headers
@@ -74,6 +75,9 @@ class OC_Response {
 			case self::STATUS_INTERNAL_SERVER_ERROR;
 				$status = $status . ' Internal Server Error';
 				break;
+			case self::STATUS_SERVICE_UNAVAILABLE;
+				$status = $status . ' Service Unavailable';
+				break;
 		}
 		header($protocol.' '.$status);
 	}
-- 
GitLab