Setting up the encryption wrapper in a setup hook - temporarily fixes the wrapping order
This commit is contained in:
parent
3458b5ab4c
commit
4db75e3407
18
lib/base.php
18
lib/base.php
|
@ -703,24 +703,8 @@ class OC {
|
||||||
private static function registerEncryptionWrapper() {
|
private static function registerEncryptionWrapper() {
|
||||||
$enabled = self::$server->getEncryptionManager()->isEnabled();
|
$enabled = self::$server->getEncryptionManager()->isEnabled();
|
||||||
if ($enabled) {
|
if ($enabled) {
|
||||||
\OC\Files\Filesystem::addStorageWrapper('oc_encryption', function ($mountPoint, $storage, \OCP\Files\Mount\IMountPoint $mount) {
|
\OCP\Util::connectHook('OC_Filesystem', 'setup', 'OC\Encryption\Manager', 'setupStorage');
|
||||||
|
|
||||||
$parameters = [
|
|
||||||
'storage' => $storage,
|
|
||||||
'mountPoint' => $mountPoint,
|
|
||||||
'mount' => $mount];
|
|
||||||
$manager = \OC::$server->getEncryptionManager();
|
|
||||||
$util = new \OC\Encryption\Util(
|
|
||||||
new \OC\Files\View(),
|
|
||||||
\OC::$server->getUserManager(),
|
|
||||||
\OC::$server->getConfig());
|
|
||||||
$user = \OC::$server->getUserSession()->getUser();
|
|
||||||
$logger = \OC::$server->getLogger();
|
|
||||||
$uid = $user ? $user->getUID() : null;
|
|
||||||
return new \OC\Files\Storage\Wrapper\Encryption($parameters, $manager, $util, $logger, $uid);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function registerEncryptionHooks() {
|
private static function registerEncryptionHooks() {
|
||||||
|
|
|
@ -23,7 +23,9 @@
|
||||||
|
|
||||||
namespace OC\Encryption;
|
namespace OC\Encryption;
|
||||||
|
|
||||||
|
use OC\Files\Storage\Wrapper\Encryption;
|
||||||
use OCP\Encryption\IEncryptionModule;
|
use OCP\Encryption\IEncryptionModule;
|
||||||
|
use OCP\Files\Mount\IMountPoint;
|
||||||
|
|
||||||
class Manager implements \OCP\Encryption\IManager {
|
class Manager implements \OCP\Encryption\IManager {
|
||||||
|
|
||||||
|
@ -181,5 +183,21 @@ class Manager implements \OCP\Encryption\IManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function setupStorage() {
|
||||||
|
\OC\Files\Filesystem::addStorageWrapper('oc_encryption', function ($mountPoint, $storage, IMountPoint $mount) {
|
||||||
|
$parameters = [
|
||||||
|
'storage' => $storage,
|
||||||
|
'mountPoint' => $mountPoint,
|
||||||
|
'mount' => $mount];
|
||||||
|
$manager = \OC::$server->getEncryptionManager();
|
||||||
|
$util = new \OC\Encryption\Util(
|
||||||
|
new \OC\Files\View(),
|
||||||
|
\OC::$server->getUserManager(),
|
||||||
|
\OC::$server->getConfig());
|
||||||
|
$user = \OC::$server->getUserSession()->getUser();
|
||||||
|
$logger = \OC::$server->getLogger();
|
||||||
|
$uid = $user ? $user->getUID() : null;
|
||||||
|
return new Encryption($parameters, $manager, $util, $logger, $uid);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue