forked from GNUsocial/gnu-social
Introduce a ConfigException
This commit is contained in:
22
lib/configexception.php
Normal file
22
lib/configexception.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* Class for configuration exceptions
|
||||
*
|
||||
* Subclass of ServerException for when the site's configuration is malformed.
|
||||
*
|
||||
* @category Exception
|
||||
* @package GNUsocial
|
||||
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||
* @license https://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link https://gnu.io/social
|
||||
*/
|
||||
|
||||
class ConfigException extends ServerException
|
||||
{
|
||||
public function __construct($message=null) {
|
||||
parent::__construct($message, 500);
|
||||
}
|
||||
}
|
||||
@@ -432,9 +432,13 @@ class GNUsocial
|
||||
if (common_config('htmlpurifier', 'Cache.DefinitionImpl') === 'Serializer'
|
||||
&& !is_dir(common_config('htmlpurifier', 'Cache.SerializerPath'))) {
|
||||
if (!mkdir(common_config('htmlpurifier', 'Cache.SerializerPath'))) {
|
||||
throw new ServerException('Could not create HTMLPurifier cache dir: '._ve(common_config('htmlpurifier', 'Cache.SerializerPath')));
|
||||
throw new ConfigException('Could not create HTMLPurifier cache dir: '._ve(common_config('htmlpurifier', 'Cache.SerializerPath')));
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_array(common_config('public', 'autosource'))) {
|
||||
throw new ConfigException('Configuration option public/autosource is not an array.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user