Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/36566/head
Robin Appelman 3 years ago
parent e3bafcc7a8
commit 9f3dbb699a
  1. 14
      lib/private/Files/Mount/MountPoint.php
  2. 4
      lib/public/Files/Mount/IMountPoint.php
  3. 3
      tests/lib/Files/ViewTest.php

@ -196,11 +196,15 @@ class MountPoint implements IMountPoint {
}
/**
* @return string
* @return string|null
*/
public function getStorageId() {
if (!$this->storageId) {
$this->storageId = $this->getStorage()->getId();
$storage = $this->getStorage();
if (is_null($storage)) {
return null;
}
$this->storageId = $storage->getId();
if (strlen($this->storageId) > 64) {
$this->storageId = md5($this->storageId);
}
@ -213,7 +217,11 @@ class MountPoint implements IMountPoint {
*/
public function getNumericStorageId() {
if (is_null($this->numericStorageId)) {
$this->numericStorageId = $this->getStorage()->getStorageCache()->getNumericId();
$storage = $this->getStorage();
if (is_null($storage)) {
return -1;
}
$this->numericStorageId = $storage->getStorageCache()->getNumericId();
}
return $this->numericStorageId;
}

@ -55,7 +55,7 @@ interface IMountPoint {
/**
* Get the id of the storages
*
* @return string
* @return string|null
* @since 8.0.0
*/
public function getStorageId();
@ -63,7 +63,7 @@ interface IMountPoint {
/**
* Get the id of the storages
*
* @return int
* @return int|null
* @since 9.1.0
*/
public function getNumericStorageId();

@ -1590,6 +1590,9 @@ class ViewTest extends \Test\TestCase {
->setConstructorArgs([[]])
->getMock();
$storage->method('getId')->willReturn('non-null-id');
$storage->method('getStorageCache')->willReturnCallback(function () use ($storage) {
return new \OC\Files\Cache\Storage($storage);
});
$mounts[] = $this->getMockBuilder(TestMoveableMountPoint::class)
->setMethods(['moveMount'])

Loading…
Cancel
Save