Skip to content

Commit

Permalink
Merge pull request #37960 from owncloud/scanner_adjustments
Browse files Browse the repository at this point in the history
Adjust scanner flags
  • Loading branch information
phil-davis authored Oct 9, 2020
2 parents 27caec0 + 6554f5a commit 18ce2c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions lib/private/Files/Cache/Scanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ public function scanFile($file, $reuseExisting = 0, $parentId = -1, $cacheData =
if (isset($data['storage_mtime'], $cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) {
$data['mtime'] = $cacheData['mtime'];
if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) {
if (($data['mimetype'] !== 'httpd/unix-directory') || !($reuseExisting & self::REUSE_ONLY_FOR_FILES)) {
$data['size'] = $cacheData['size'];
}
$data['size'] = $cacheData['size'];
}
if ($reuseExisting & self::REUSE_ETAG) {
if (($data['mimetype'] !== 'httpd/unix-directory') || !($reuseExisting & self::REUSE_ONLY_FOR_FILES)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Cache/Watcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function checkUpdate($path, $cachedEntry = null) {
*/
public function update($path, $cachedData) {
if ($this->storage->is_dir($path)) {
$this->scanner->scan($path, Scanner::SCAN_SHALLOW, Scanner::REUSE_ETAG | Scanner::REUSE_ONLY_FOR_FILES);
$this->scanner->scan($path, Scanner::SCAN_SHALLOW, Scanner::REUSE_ETAG | Scanner::REUSE_SIZE | Scanner::REUSE_ONLY_FOR_FILES);
} else {
$this->scanner->scanFile($path);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/Cache/IScanner.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface IScanner {
const REUSE_NONE = 0;
const REUSE_ETAG = 1;
const REUSE_SIZE = 2;
const REUSE_ONLY_FOR_FILES = 4; // apply the reuse (either tag or size) only to files, not folders
const REUSE_ONLY_FOR_FILES = 4; // apply the etag reuse only to files, not folders

/**
* scan a single file and store it in the cache
Expand Down

0 comments on commit 18ce2c8

Please sign in to comment.