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.
This commit is contained in:
parent
fa7446d86d
commit
2e45eb8ad6
|
@ -23,6 +23,14 @@
|
||||||
|
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
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