Skip to content

Commit

Permalink
Revert "Sort by top-most path in getIncomplete()"
Browse files Browse the repository at this point in the history
This reverts commit 71c78a0.
  • Loading branch information
ariselseng committed Mar 1, 2019
1 parent 71c78a0 commit 8f82353
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
* @copyright Copyright (c) 2016, ownCloud, Inc.
*
* @author Andreas Fischer <bantu@owncloud.com>
* @author Ari Selseng <ari@selseng.net>
* @author Artem Kochnev <MrJeos@gmail.com>
* @author Björn Schießle <bjoern@schiessle.org>
* @author Florin Peter <github@florin-peter.de>
Expand Down Expand Up @@ -846,14 +845,15 @@ public function getAll() {
/**
* find a folder in the cache which has not been fully scanned
*
* If multiple incomplete folders are in the cache, the top-most folder will be returned
* This avoids a weird edge case when multiple incomplete folders do not get scanned properly
* If multiple 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 = $this->connection->prepare('SELECT `path` FROM `*PREFIX*filecache`'
. ' WHERE `storage` = ? AND `size` = -1 ORDER BY `path` ASC', 1);
. ' WHERE `storage` = ? AND `size` = -1 ORDER BY `fileid` DESC', 1);
$query->execute([$this->getNumericStorageId()]);
if ($row = $query->fetch()) {
return $row['path'];
Expand Down

0 comments on commit 8f82353

Please sign in to comment.