Add better maintenance handling

This commit is contained in:
Romain Neutron
2013-06-19 17:43:52 +02:00
parent 5604455695
commit ae89305575
13 changed files with 319 additions and 53 deletions

View 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.';
}

View File

@@ -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;