Verify loaded config function, must be completed further.

This commit is contained in:
Mikael Nordfeldth 2016-02-28 13:31:21 +01:00
parent 747c91210f
commit 6c43e9c2e0

View File

@ -141,6 +141,8 @@ class GNUsocial
// Load settings from database; note we need autoload for this
Config::loadSettings();
self::verifyLoadedConfig();
self::initPlugins();
}
@ -418,6 +420,23 @@ class GNUsocial
}
}
/**
* Verify that the loaded config is good. Not complete, but will
* throw exceptions on common configuration problems I hope.
*
* Might make changes to the filesystem, to created dirs, but will
* not make database changes.
*/
static function verifyLoadedConfig()
{
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')));
}
}
}
/**
* Are we running from the web with HTTPS?
*