From: Mikael Nordfeldth Date: Sun, 28 Feb 2016 12:31:21 +0000 (+0100) Subject: Verify loaded config function, must be completed further. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=6c43e9c2e0934a9da2cb7947024ca7e3702c3f91;p=quix0rs-gnu-social.git Verify loaded config function, must be completed further. --- diff --git a/lib/gnusocial.php b/lib/gnusocial.php index 277c41e7c8..2ad688a790 100644 --- a/lib/gnusocial.php +++ b/lib/gnusocial.php @@ -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? *