summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Gonzalez Labrador <hglavra@gmail.com>2015-05-06 10:03:18 +0200
committerHugo Gonzalez Labrador <hglavra@gmail.com>2015-05-06 10:03:18 +0200
commit3a3a58f24839cc14b726cb8a272847d0b4f4153e (patch)
tree2319a7d9213153b27615e680de1dd02f4ef2fcf7
parentf1903f61a11c9e9c7a5b50af82883031cb1e95c1 (diff)
downloadnextcloud-server-3a3a58f24839cc14b726cb8a272847d0b4f4153e.tar.gz
nextcloud-server-3a3a58f24839cc14b726cb8a272847d0b4f4153e.zip
Do not trigger preview hooks if enable_previews is false
-rw-r--r--lib/base.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/base.php b/lib/base.php
index 86620ff95a7..ae87b341427 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -766,13 +766,15 @@ class OC {
* register hooks for previews
*/
public static function registerPreviewHooks() {
- 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');
+ 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');
+ }
}
/**