]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't add the Encryption Storage Wrapper if there are no encryption modules
authorRoeland Jago Douma <roeland@famdouma.nl>
Wed, 29 Mar 2017 10:23:46 +0000 (12:23 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Wed, 29 Mar 2017 16:57:56 +0000 (18:57 +0200)
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 <roeland@famdouma.nl>
lib/private/Encryption/Manager.php

index 4d40675801eb206ea9823e00b03e8cff761bfe14..9053e371b651dc0fd9cb44eddda9697b47352ca1 100644 (file)
@@ -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);
+               }
        }