allow to disable encryption

Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
This commit is contained in:
Bjoern Schiessle 2018-07-05 16:57:48 +02:00
parent 642ebea490
commit 3a45bb52bc
No known key found for this signature in database
GPG Key ID: 2378A753E2BF04F6
1 changed files with 6 additions and 2 deletions

View File

@ -414,9 +414,13 @@ class Encryption extends Wrapper {
|| $mode === 'wb'
|| $mode === 'wb+'
) {
// don't overwrite encrypted files if encryption is not enabled
// if we update a encrypted file with a un-encrypted one we change the db flag
if ($targetIsEncrypted && $encryptionEnabled === false) {
throw new GenericEncryptionException('Tried to access encrypted file but encryption is not enabled');
$cache = $this->storage->getCache();
if ($cache) {
$entry = $cache->get($path);
$cache->update($entry->getId(), ['encrypted' => 0]);
}
}
if ($encryptionEnabled) {
// if $encryptionModuleId is empty, the default module will be used