summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2017-02-16 11:47:16 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-03-23 00:02:48 -0600
commit89c42a76c34aba7dd4c23649f97495283cf023ba (patch)
tree4252d22cb431a00f8dcda5d52e0080d1fdff16d8 /lib/private/Files
parent39ac804899197069b40384afdc40966e22658eca (diff)
downloadnextcloud-server-89c42a76c34aba7dd4c23649f97495283cf023ba.tar.gz
nextcloud-server-89c42a76c34aba7dd4c23649f97495283cf023ba.zip
Remove SharedCache::getNumericStorageId to let CacheWrapper do it
The CacheWrapper will properly forward the call to the wrapped cache. Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Cache/Cache.php8
1 files changed, 8 insertions, 0 deletions
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` = ?';