summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-11-21 23:02:43 +0100
committerRobin Appelman <icewind@owncloud.com>2012-11-22 12:45:29 +0100
commit186c9e77e89dcd057a311ed08df9e1bb9e13ea8f (patch)
tree9c7783afda9de98f29c0d16379a28be87484cec4 /lib
parente6cf082fe07e4e33c883bd5f9aaa0cc72b082741 (diff)
downloadnextcloud-server-186c9e77e89dcd057a311ed08df9e1bb9e13ea8f.tar.gz
nextcloud-server-186c9e77e89dcd057a311ed08df9e1bb9e13ea8f.zip
add Cache->getIncomplete for use in background scanning
Diffstat (limited to 'lib')
-rw-r--r--lib/files/cache/cache.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 7c6bba4fadb..b52c0f40677 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -402,4 +402,23 @@ class Cache {
}
return $ids;
}
+
+ /**
+ * 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(){
+ $query = \OC_DB::prepare('SELECT `path` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC LIMIT 1');
+ $query->execute(array($this->storageId));
+ if($row = $query->fetchRow()){
+ return $row['path'];
+ }else{
+ return false;
+ }
+ }
}