diff --git a/lib/base.php b/lib/base.php index ae87b34142..a9d582dcc3 100644 --- a/lib/base.php +++ b/lib/base.php @@ -654,7 +654,9 @@ class OC { self::registerCacheHooks(); self::registerFilesystemHooks(); - self::registerPreviewHooks(); + if (\OC::$server->getSystemConfig()->getValue('enable_previews', false)) { + self::registerPreviewHooks(); + } self::registerShareHooks(); self::registerLogRotate(); self::registerLocalAddressBook(); @@ -766,15 +768,13 @@ class OC { * register hooks for previews */ public static function registerPreviewHooks() { - if (\OC::$server->getSystemConfig()->getValue('enable_previews', false)) { - OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write'); - OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'prepare_delete_files'); - OC_Hook::connect('\OCP\Versions', 'preDelete', 'OC\Preview', 'prepare_delete'); - OC_Hook::connect('\OCP\Trashbin', 'preDelete', 'OC\Preview', 'prepare_delete'); - OC_Hook::connect('OC_Filesystem', 'post_delete', 'OC\Preview', 'post_delete_files'); - OC_Hook::connect('\OCP\Versions', 'delete', 'OC\Preview', 'post_delete'); - OC_Hook::connect('\OCP\Trashbin', 'delete', 'OC\Preview', 'post_delete'); - } + OC_Hook::connect('OC_Filesystem', 'post_write', 'OC\Preview', 'post_write'); + OC_Hook::connect('OC_Filesystem', 'delete', 'OC\Preview', 'prepare_delete_files'); + OC_Hook::connect('\OCP\Versions', 'preDelete', 'OC\Preview', 'prepare_delete'); + OC_Hook::connect('\OCP\Trashbin', 'preDelete', 'OC\Preview', 'prepare_delete'); + OC_Hook::connect('OC_Filesystem', 'post_delete', 'OC\Preview', 'post_delete_files'); + OC_Hook::connect('\OCP\Versions', 'delete', 'OC\Preview', 'post_delete'); + OC_Hook::connect('\OCP\Trashbin', 'delete', 'OC\Preview', 'post_delete'); } /**