mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +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;
|
||||
|
@@ -50,7 +50,6 @@ class registry implements registryInterface
|
||||
if ($app['phraseanet.configuration-tester']->isInstalled()) {
|
||||
$this->cache->save('GV_ServerName', $app['phraseanet.configuration']['main']['servername']);
|
||||
$this->cache->save('GV_debug', $app['debug']);
|
||||
$this->cache->save('GV_maintenance', $app['phraseanet.configuration']['main']['maintenance']);
|
||||
|
||||
$config = $app['phraseanet.configuration']->getConfig();
|
||||
|
||||
@@ -91,7 +90,7 @@ class registry implements registryInterface
|
||||
|
||||
}
|
||||
foreach ($rs as $row) {
|
||||
if (in_array($row['key'], array('GV_ServerName', 'GV_sit', 'GV_debug', 'GV_maintenance'))) {
|
||||
if (in_array($row['key'], array('GV_ServerName', 'GV_sit', 'GV_debug'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user