fixed file_proxy handling
This commit is contained in:
parent
25ff32db6b
commit
170d09203f
|
@ -52,11 +52,14 @@ class Keymanager {
|
|||
*/
|
||||
public static function getPublicKey( \OC_FilesystemView $view, $userId ) {
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
return $view->file_get_contents( '/public-keys/' . $userId . '.public.key' );
|
||||
$result = $view->file_get_contents( '/public-keys/' . $userId . '.public.key' );
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
@ -176,6 +179,7 @@ class Keymanager {
|
|||
|
||||
$keyfilePath = '/' . $owner . '/files_encryption/keyfiles/' . $filePath_f . '.key';
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
if ( $view->file_exists( $keyfilePath ) ) {
|
||||
|
@ -188,7 +192,7 @@ class Keymanager {
|
|||
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
return $result;
|
||||
|
||||
|
@ -244,14 +248,16 @@ class Keymanager {
|
|||
|
||||
$view = new \OC_FilesystemView( '/' . $user . '/files_encryption' );
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
if ( !$view->file_exists( '' ) ) $view->mkdir( '' );
|
||||
|
||||
return $view->file_put_contents( $user . '.private.key', $key );
|
||||
$result = $view->file_put_contents( $user . '.private.key', $key );
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -277,13 +283,16 @@ class Keymanager {
|
|||
|
||||
$view = new \OC_FilesystemView( '/public-keys' );
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
if ( !$view->file_exists( '' ) ) $view->mkdir( '' );
|
||||
|
||||
return $view->file_put_contents( \OCP\User::getUser() . '.public.key', $key );
|
||||
$result = $view->file_put_contents( \OCP\User::getUser() . '.public.key', $key );
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
@ -311,10 +320,13 @@ class Keymanager {
|
|||
|
||||
$writePath = $basePath . '/' . $shareKeyPath . '.' . $userId . '.shareKey';
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$result = $view->file_put_contents( $writePath, $shareKey );
|
||||
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
if (
|
||||
is_int( $result )
|
||||
&& $result > 0
|
||||
|
@ -369,6 +381,7 @@ class Keymanager {
|
|||
*/
|
||||
public static function getShareKey( \OC_FilesystemView $view, $userId, $filePath ) {
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
|
@ -387,7 +400,7 @@ class Keymanager {
|
|||
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = true;
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
return $result;
|
||||
|
||||
|
@ -417,6 +430,7 @@ class Keymanager {
|
|||
*/
|
||||
public static function delShareKey( \OC_FilesystemView $view, $userIds, $filePath ) {
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
|
@ -448,7 +462,7 @@ class Keymanager {
|
|||
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
return $result;
|
||||
|
||||
|
@ -472,7 +486,7 @@ class Keymanager {
|
|||
foreach ( $subdirs as $subdir ) {
|
||||
self::recursiveDelShareKeys($subdir, $userIds);
|
||||
}
|
||||
return $true;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue