removed dead code for delShareKey
This commit is contained in:
parent
8e0540d0e4
commit
1fa2f19ee4
|
@ -67,13 +67,13 @@ class Hooks {
|
||||||
// If migration not yet done
|
// If migration not yet done
|
||||||
if ( ! $migrationCompleted ) {
|
if ( ! $migrationCompleted ) {
|
||||||
|
|
||||||
$view1 = new \OC_FilesystemView( '/' . $params['uid'] );
|
$userView = new \OC_FilesystemView( '/' . $params['uid'] );
|
||||||
|
|
||||||
// Set legacy encryption key if it exists, to support
|
// Set legacy encryption key if it exists, to support
|
||||||
// depreciated encryption system
|
// depreciated encryption system
|
||||||
if (
|
if (
|
||||||
$view1->file_exists( 'encryption.key' )
|
$userView->file_exists( 'encryption.key' )
|
||||||
&& $encLegacyKey = $view1->file_get_contents( 'encryption.key' )
|
&& $encLegacyKey = $userView->file_get_contents( 'encryption.key' )
|
||||||
) {
|
) {
|
||||||
|
|
||||||
$plainLegacyKey = Crypt::legacyDecrypt( $encLegacyKey, $params['password'] );
|
$plainLegacyKey = Crypt::legacyDecrypt( $encLegacyKey, $params['password'] );
|
||||||
|
@ -413,25 +413,11 @@ class Hooks {
|
||||||
// Unshare every user who no longer has access to the file
|
// Unshare every user who no longer has access to the file
|
||||||
$delUsers = array_diff( $userIds, $sharingUsers);
|
$delUsers = array_diff( $userIds, $sharingUsers);
|
||||||
|
|
||||||
if ( !Keymanager::delShareKey( $view, $delUsers, $path ) ) {
|
// delete share key
|
||||||
|
Keymanager::delShareKey( $view, $delUsers, $path );
|
||||||
$failed[] = $path;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no attempts to set keyfiles failed
|
|
||||||
if ( empty( $failed ) ) {
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -540,32 +540,23 @@ class Keymanager
|
||||||
|
|
||||||
$shareKeyPath = '/' . $owner . '/files_encryption/share-keys/' . $filename;
|
$shareKeyPath = '/' . $owner . '/files_encryption/share-keys/' . $filename;
|
||||||
|
|
||||||
$result = false;
|
|
||||||
|
|
||||||
if ($view->is_dir($shareKeyPath)) {
|
if ($view->is_dir($shareKeyPath)) {
|
||||||
|
|
||||||
$localPath = \OC_Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
|
$localPath = \OC\Files\Filesystem::normalizePath($view->getLocalFolder($shareKeyPath));
|
||||||
$result = self::recursiveDelShareKeys($localPath, $userIds);
|
self::recursiveDelShareKeys($localPath, $userIds);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
foreach ($userIds as $userId) {
|
foreach ($userIds as $userId) {
|
||||||
$view->unlink($shareKeyPath . '.' . $userId . '.shareKey');
|
|
||||||
|
if (!$view->unlink($shareKeyPath . '.' . $userId . '.shareKey')) {
|
||||||
|
\OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath . '.' . $userId . '.shareKey"', \OC_Log::ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
|
|
||||||
\OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $shareKeyPath, \OC_Log::ERROR);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\OC_FileProxy::$enabled = $proxyStatus;
|
\OC_FileProxy::$enabled = $proxyStatus;
|
||||||
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -582,13 +573,14 @@ class Keymanager
|
||||||
}
|
}
|
||||||
/** @var $matches array */
|
/** @var $matches array */
|
||||||
foreach ($matches as $ma) {
|
foreach ($matches as $ma) {
|
||||||
unlink($ma);
|
if (!unlink($ma)) {
|
||||||
|
\OC_Log::write('Encryption library', 'Could not delete shareKey; does not exist: "' . $ma . '"', \OC_Log::ERROR);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$subdirs = $directories = glob(preg_quote($dir) . '/*', GLOB_ONLYDIR);
|
$subdirs = $directories = glob(preg_quote($dir) . '/*', GLOB_ONLYDIR);
|
||||||
foreach ($subdirs as $subdir) {
|
foreach ($subdirs as $subdir) {
|
||||||
self::recursiveDelShareKeys($subdir, $userIds);
|
self::recursiveDelShareKeys($subdir, $userIds);
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue