From 111c9f7563f1ac43d8e615a2aa8dc89375a1ffb6 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Wed, 29 Mar 2017 12:23:46 +0200 Subject: [PATCH 1/2] 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(-) diff --git a/lib/private/Encryption/Manager.php b/lib/private/Encryption/Manager.php index 4d40675801eb2..9053e371b651d 100644 --- a/lib/private/Encryption/Manager.php +++ b/lib/private/Encryption/Manager.php @@ -254,8 +254,11 @@ public function getDefaultEncryptionModuleId() { * 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); + } } From 7d4c4224d109331fe10c147ac72fc3b0a3aaee32 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 30 Mar 2017 17:16:59 +0200 Subject: [PATCH 2/2] fix setup of external storage integration tests Signed-off-by: Robin Appelman --- build/integration/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/integration/run.sh b/build/integration/run.sh index 282a430339552..45c2bcdaf2b3c 100755 --- a/build/integration/run.sh +++ b/build/integration/run.sh @@ -44,7 +44,7 @@ if [ "$INSTALLED" == "true" ]; then $OCC app:enable files_external mkdir -p work/local_storage - OUTPUT_CREATE_STORAGE=`$OCC files_external:create local_storage local null::null -c datadir=./build/integration/work/local_storage` + OUTPUT_CREATE_STORAGE=`$OCC files_external:create local_storage local null::null -c datadir=$PWD/work/local_storage` ID_STORAGE=`echo $OUTPUT_CREATE_STORAGE | tr ' ' '\n' | tail -n1`