fix shared storage numeric id

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2017-03-27 14:05:01 +02:00
parent 869ba16273
commit ae3016959e
No known key found for this signature in database
GPG Key ID: 50F2B59C6DEBBCFE
3 changed files with 11 additions and 0 deletions

View File

@ -51,6 +51,8 @@ class Cache extends CacheJail {
private $ownerDisplayName;
private $numericId;
/**
* @param \OCA\Files_Sharing\SharedStorage $storage
* @param ICacheEntry $sourceRootInfo
@ -58,6 +60,7 @@ class Cache extends CacheJail {
public function __construct($storage, ICacheEntry $sourceRootInfo) {
$this->storage = $storage;
$this->sourceRootInfo = $sourceRootInfo;
$this->numericId = $sourceRootInfo->getStorageId();
parent::__construct(
null,
$this->sourceRootInfo->getPath()

View File

@ -337,6 +337,11 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto
return $this->superShare->getNodeType();
}
/**
* @param string $path
* @param null $storage
* @return Cache
*/
public function getCache($path = '', $storage = null) {
if ($this->cache) {
return $this->cache;

View File

@ -30,6 +30,8 @@
namespace OCA\Files_Sharing\Tests;
use OCA\Files_Sharing\SharedStorage;
/**
* Class CacheTest
*
@ -545,6 +547,7 @@ class CacheTest extends TestCase {
self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
$this->assertTrue(\OC\Files\Filesystem::file_exists('/foo'));
/** @var SharedStorage $sharedStorage */
list($sharedStorage) = \OC\Files\Filesystem::resolvePath('/' . self::TEST_FILES_SHARING_API_USER2 . '/files/foo');
$this->assertEquals($sourceStorage->getCache()->getNumericStorageId(), $sharedStorage->getCache()->getNumericStorageId());