Merge pull request #9306 from owncloud/publicneedsupgrade
Return 503 in public.php and OCS API when upgrade is due
This commit is contained in:
commit
75a5746b70
|
@ -301,7 +301,7 @@ class OC_API {
|
||||||
* @param OC_OCS_Result $result
|
* @param OC_OCS_Result $result
|
||||||
* @param string $format the format xml|json
|
* @param string $format the format xml|json
|
||||||
*/
|
*/
|
||||||
private static function respond($result, $format='xml') {
|
public static function respond($result, $format='xml') {
|
||||||
// Send 401 headers if unauthorised
|
// Send 401 headers if unauthorised
|
||||||
if($result->getStatusCode() === self::RESPOND_UNAUTHORISED) {
|
if($result->getStatusCode() === self::RESPOND_UNAUTHORISED) {
|
||||||
header('WWW-Authenticate: Basic realm="Authorisation Required"');
|
header('WWW-Authenticate: Basic realm="Authorisation Required"');
|
||||||
|
|
|
@ -23,6 +23,15 @@
|
||||||
|
|
||||||
require_once '../lib/base.php';
|
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);
|
||||||
|
$response = new OC_OCS_Result(null, OC_Response::STATUS_SERVICE_UNAVAILABLE, 'Service unavailable');
|
||||||
|
OC_API::respond($response, OC_API::requestedFormat());
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,14 @@
|
||||||
try {
|
try {
|
||||||
|
|
||||||
require_once 'lib/base.php';
|
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::checkMaintenanceMode();
|
||||||
OC::checkSingleUserMode();
|
OC::checkSingleUserMode();
|
||||||
$pathInfo = OC_Request::getPathInfo();
|
$pathInfo = OC_Request::getPathInfo();
|
||||||
|
|
Loading…
Reference in New Issue