From 111c9f7563f1ac43d8e615a2aa8dc89375a1ffb6 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 29 Mar 2017 12:23:46 +0200 Subject: Don't add the Encryption Storage Wrapper if there are no encryption modules fixes #4125 If there is no encryption module enabled it makes no sense to setup the encryption wrapper (because we can't do anything anyway). This saves reading the header of files. Especialy on external storage/objectstore this should improve performance Signed-off-by: Roeland Jago Douma --- lib/private/Encryption/Manager.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php index 4d40675801e..9053e371b65 100644 --- a/lib/private/Encryption/Manager.php +++ b/lib/private/Encryption/Manager.php @@ -254,8 +254,11 @@ class Manager implements IManager { * Add storage wrapper */ public function setupStorage() { - $encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger); - Filesystem::addStorageWrapper('oc_encryption', array($encryptionWrapper, 'wrapStorage'), 2); + // If encryption is disabled and there are no loaded modules it makes no sense to load the wrapper + if (!empty($this->encryptionModules) || $this->isEnabled()) { + $encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger); + Filesystem::addStorageWrapper('oc_encryption', array($encryptionWrapper, 'wrapStorage'), 2); + } } -- cgit v1.2.3