aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/encryption/manager.php
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2016-03-30 23:20:37 +0200
committerBjoern Schiessle <schiessle@owncloud.com>2016-03-31 19:24:47 +0200
commit93ed965cbb1952faafc1ca5e09ee0de84d122c05 (patch)
tree2631e5302305b9b59b25b006edca19650ca2a1bc /lib/private/encryption/manager.php
parent8ef6c6c7bcf0b58561aee6ec1a18ea7a8643a773 (diff)
downloadnextcloud-server-93ed965cbb1952faafc1ca5e09ee0de84d122c05.tar.gz
nextcloud-server-93ed965cbb1952faafc1ca5e09ee0de84d122c05.zip
fix creation of versions of encrypted files on external storages
in order to create a 1:1 copy of a file if a version gets created we need to store this information on copyBetweenStorage(). This allows us to by-pass the encryption wrapper if we read the source file.
Diffstat (limited to 'lib/private/encryption/manager.php')
-rw-r--r--lib/private/encryption/manager.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/lib/private/encryption/manager.php b/lib/private/encryption/manager.php
index d1d17a92887..d45bbf07ee9 100644
--- a/lib/private/encryption/manager.php
+++ b/lib/private/encryption/manager.php
@@ -27,6 +27,7 @@ namespace OC\Encryption;
use OC\Encryption\Keys\Storage;
use OC\Files\Filesystem;
use OC\Files\View;
+use OC\Memcache\ArrayCache;
use OC\ServiceUnavailableException;
use OCP\Encryption\IEncryptionModule;
use OCP\Encryption\IManager;
@@ -54,20 +55,25 @@ class Manager implements IManager {
/** @var Util */
protected $util;
+ /** @var ArrayCache */
+ protected $arrayCache;
+
/**
* @param IConfig $config
* @param ILogger $logger
* @param IL10N $l10n
* @param View $rootView
* @param Util $util
+ * @param ArrayCache $arrayCache
*/
- public function __construct(IConfig $config, ILogger $logger, IL10N $l10n, View $rootView, Util $util) {
+ public function __construct(IConfig $config, ILogger $logger, IL10N $l10n, View $rootView, Util $util, ArrayCache $arrayCache) {
$this->encryptionModules = array();
$this->config = $config;
$this->logger = $logger;
$this->l = $l10n;
$this->rootView = $rootView;
$this->util = $util;
+ $this->arrayCache = $arrayCache;
}
/**
@@ -227,14 +233,9 @@ class Manager implements IManager {
/**
* Add storage wrapper
*/
- public static function setupStorage() {
- $util = new Util(
- new View(),
- \OC::$server->getUserManager(),
- \OC::$server->getGroupManager(),
- \OC::$server->getConfig()
- );
- Filesystem::addStorageWrapper('oc_encryption', array($util, 'wrapStorage'), 2);
+ public function setupStorage() {
+ $encryptionWrapper = new EncryptionWrapper($this->arrayCache, $this, $this->logger);
+ Filesystem::addStorageWrapper('oc_encryption', array($encryptionWrapper, 'wrapStorage'), 2);
}