diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2017-03-28 21:56:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-28 21:56:44 +0200 |
commit | 4821c00ea81797fcb5a99c31105ad42be598f113 (patch) | |
tree | 6b56762ce35894d849ffc139dfddb3c19e1fc97e /lib | |
parent | e26f138fc596492da88b8a0d57749f5703e1d100 (diff) | |
parent | ae3016959e6cbcadcd5169fa9e35a332abcc4495 (diff) | |
download | nextcloud-server-4821c00ea81797fcb5a99c31105ad42be598f113.tar.gz nextcloud-server-4821c00ea81797fcb5a99c31105ad42be598f113.zip |
Merge pull request #4004 from nextcloud/backport-27172
Remove SharedCache::getNumericStorageId to let CacheWrapper do it
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 9b2cff62627..2b04226f20e 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` = ?'; |