mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 18:44:30 +00:00
Add better maintenance handling
This commit is contained in:
21
lib/classes/API/V1/exception/maintenance.php
Normal file
21
lib/classes/API/V1/exception/maintenance.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package APIv1
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class API_V1_exception_maintenance extends API_V1_exception_abstract
|
||||
{
|
||||
protected static $details = 'Server is offline for maintenance, try again soon.';
|
||||
}
|
@@ -89,6 +89,7 @@ class API_V1_result
|
||||
const ERROR_UNAUTHORIZED = 'Unauthorized';
|
||||
const ERROR_FORBIDDEN = 'Forbidden';
|
||||
const ERROR_NOTFOUND = 'Not Found';
|
||||
const ERROR_MAINTENANCE = 'Service Temporarily Unavailable';
|
||||
const ERROR_METHODNOTALLOWED = 'Method Not Allowed';
|
||||
const ERROR_INTERNALSERVERERROR = 'Internal Server Error';
|
||||
|
||||
@@ -295,6 +296,11 @@ class API_V1_result
|
||||
$this->error_type = $const;
|
||||
$this->error_message = API_V1_exception_internalservererror::get_details();
|
||||
break;
|
||||
case self::ERROR_MAINTENANCE:
|
||||
$this->http_code = 503;
|
||||
$this->error_type = $const;
|
||||
$this->error_message = API_V1_exception_maintenance::get_details();
|
||||
break;
|
||||
case OAUTH2_ERROR_INVALID_REQUEST:
|
||||
$this->error_type = $const;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user