Browse Source
getStorage can also return null
Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/26219/head
Robin Appelman
5 years ago
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
6 changed files with
7 additions and
7 deletions
-
apps/encryption/lib/Crypto/Encryption.php
-
apps/encryption/lib/Util.php
-
lib/private/Files/Filesystem.php
-
lib/private/Files/Mount/MountPoint.php
-
lib/private/Files/Node/Folder.php
-
lib/public/Files/Mount/IMountPoint.php
|
|
|
@ -435,7 +435,7 @@ class Encryption implements IEncryptionModule { |
|
|
|
public function shouldEncrypt($path) { |
|
|
|
if ($this->util->shouldEncryptHomeStorage() === false) { |
|
|
|
$storage = $this->util->getStorage($path); |
|
|
|
if ($storage->instanceOfStorage('\OCP\Files\IHomeStorage')) { |
|
|
|
if ($storage && $storage->instanceOfStorage('\OCP\Files\IHomeStorage')) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ class Util { |
|
|
|
* get storage of path |
|
|
|
* |
|
|
|
* @param string $path |
|
|
|
* @return \OC\Files\Storage\Storage |
|
|
|
* @return \OC\Files\Storage\Storage|null |
|
|
|
*/ |
|
|
|
public function getStorage($path) { |
|
|
|
return $this->files->getMount($path)->getStorage(); |
|
|
|
|
|
|
|
@ -312,7 +312,7 @@ class Filesystem { |
|
|
|
* get the storage mounted at $mountPoint |
|
|
|
* |
|
|
|
* @param string $mountPoint |
|
|
|
* @return \OC\Files\Storage\Storage |
|
|
|
* @return \OC\Files\Storage\Storage|null |
|
|
|
*/ |
|
|
|
public static function getStorage($mountPoint) { |
|
|
|
if (!self::$mounts) { |
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ use OCP\ILogger; |
|
|
|
|
|
|
|
class MountPoint implements IMountPoint { |
|
|
|
/** |
|
|
|
* @var \OC\Files\Storage\Storage $storage |
|
|
|
* @var \OC\Files\Storage\Storage|null $storage |
|
|
|
*/ |
|
|
|
protected $storage = null; |
|
|
|
protected $class; |
|
|
|
@ -167,7 +167,7 @@ class MountPoint implements IMountPoint { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @return \OC\Files\Storage\Storage |
|
|
|
* @return \OC\Files\Storage\Storage|null |
|
|
|
*/ |
|
|
|
public function getStorage() { |
|
|
|
if (is_null($this->storage)) { |
|
|
|
|
|
|
|
@ -494,7 +494,7 @@ class Folder extends Node implements \OCP\Files\Folder { |
|
|
|
$mounts[] = $this->getMountPoint(); |
|
|
|
|
|
|
|
$mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
|
|
return $mount->getStorage(); |
|
|
|
return $mount->getStorage() !== null; |
|
|
|
}); |
|
|
|
$storageIds = array_map(function (IMountPoint $mount) { |
|
|
|
return $mount->getStorage()->getCache()->getNumericStorageId(); |
|
|
|
|
|
|
|
@ -48,7 +48,7 @@ interface IMountPoint { |
|
|
|
/** |
|
|
|
* Get the storage that is mounted |
|
|
|
* |
|
|
|
* @return \OC\Files\Storage\Storage |
|
|
|
* @return \OC\Files\Storage\Storage|null |
|
|
|
* @since 8.0.0 |
|
|
|
*/ |
|
|
|
public function getStorage(); |
|
|
|
|