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? *