From 89c42a76c34aba7dd4c23649f97495283cf023ba Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 16 Feb 2017 11:47:16 +0100 Subject: Remove SharedCache::getNumericStorageId to let CacheWrapper do it The CacheWrapper will properly forward the call to the wrapped cache. Signed-off-by: Morris Jobke --- lib/private/Files/Cache/Cache.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/private/Files') diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 9c3b786ae87..dfe368d9d22 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -500,6 +500,7 @@ class Cache implements ICache { * @param string $sourcePath * @param string $targetPath * @throws \OC\DatabaseException + * @throws \Exception if the given storages have an invalid id */ public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) { if ($sourceCache instanceof Cache) { @@ -514,6 +515,13 @@ class Cache implements ICache { list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath); list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath); + if (is_null($sourceStorageId) || $sourceStorageId === false) { + throw new \Exception('Invalid source storage id: ' . $sourceStorageId); + } + if (is_null($targetStorageId) || $targetStorageId === false) { + throw new \Exception('Invalid target storage id: ' . $targetStorageId); + } + // sql for final update $moveSql = 'UPDATE `*PREFIX*filecache` SET `storage` = ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` =? WHERE `fileid` = ?'; -- cgit v1.2.3