Merge pull request #3222 from owncloud/fix-3218

Fix retrieving of mount points for shared storage, fix #3218
This commit is contained in:
Bart Visscher 2013-05-03 06:02:33 -07:00
commit a541b80592
4 changed files with 31 additions and 7 deletions

View file

@ -45,8 +45,8 @@ class Shared_Cache extends Cache {
if (isset($source['path']) && isset($source['fileOwner'])) { if (isset($source['path']) && isset($source['fileOwner'])) {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']); \OC\Files\Filesystem::initMountPoints($source['fileOwner']);
$mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']); $mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
if ($mount) { if (is_array($mount)) {
$fullPath = $mount->getMountPoint().$source['path']; $fullPath = $mount[key($mount)]->getMountPoint().$source['path'];
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath); list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($fullPath);
if ($storage) { if ($storage) {
$this->files[$target] = $internalPath; $this->files[$target] = $internalPath;
@ -60,6 +60,14 @@ class Shared_Cache extends Cache {
return false; return false;
} }
public function getNumericStorageId() {
if (isset($this->numericId)) {
return $this->numericId;
} else {
return false;
}
}
/** /**
* get the stored metadata of a file or folder * get the stored metadata of a file or folder
* *
@ -267,4 +275,17 @@ class Shared_Cache extends Cache {
return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_GET_ALL); return \OCP\Share::getItemsSharedWith('file', \OC_Share_Backend_File::FORMAT_GET_ALL);
} }
} /**
* find a folder in the cache which has not been fully scanned
*
* If multiply incomplete folders are in the cache, the one with the highest id will be returned,
* use the one with the highest id gives the best result with the background scanner, since that is most
* likely the folder where we stopped scanning previously
*
* @return string|bool the path of the folder or false when no folder matched
*/
public function getIncomplete() {
return false;
}
}

View file

@ -72,8 +72,8 @@ class Shared extends \OC\Files\Storage\Common {
if (!isset($source['fullPath'])) { if (!isset($source['fullPath'])) {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']); \OC\Files\Filesystem::initMountPoints($source['fileOwner']);
$mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']); $mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
if ($mount) { if (is_array($mount)) {
$this->files[$target]['fullPath'] = $mount->getMountPoint().$source['path']; $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint().$source['path'];
} else { } else {
$this->files[$target]['fullPath'] = false; $this->files[$target]['fullPath'] = false;
} }

View file

@ -199,7 +199,7 @@ class Filesystem {
* @return Mount\Mount[] * @return Mount\Mount[]
*/ */
public static function getMountByNumericId($id) { public static function getMountByNumericId($id) {
return self::$mounts->findByStorageId($id); return self::$mounts->findByNumericId($id);
} }
/** /**

View file

@ -875,7 +875,10 @@ class Share {
$row['path'] = '/Shared/'.basename($row['path']); $row['path'] = '/Shared/'.basename($row['path']);
} else { } else {
if (!isset($mounts[$row['storage']])) { if (!isset($mounts[$row['storage']])) {
$mounts[$row['storage']] = \OC\Files\Filesystem::getMountByNumericId($row['storage']); $mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']);
if (is_array($mountPoints)) {
$mounts[$row['storage']] = $mountPoints[key($mountPoints)];
}
} }
if ($mounts[$row['storage']]) { if ($mounts[$row['storage']]) {
$path = $mounts[$row['storage']]->getMountPoint().$row['path']; $path = $mounts[$row['storage']]->getMountPoint().$row['path'];