Skip to content

Commit

Permalink
Scan the shared external storage source on access
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 11, 2021
1 parent 7f69a60 commit 446879a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lib/private/Files/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
use OC\Files\Mount\MoveableMount;
use OC\Files\Storage\Storage;
use OC\User\User;
use OCA\Files_External\Config\ExternalMountPoint;
use OCA\Files_Sharing\SharedMount;
use OCP\Constants;
use OCP\Files\Cache\ICacheEntry;
Expand Down Expand Up @@ -1389,6 +1390,24 @@ public function getFileInfo($path, $includeMountPoints = true) {
}
$storage = $mount->getStorage();
$internalPath = $mount->getInternalPath($path);

// This mount is a share, checking if it
// originates from an external storage
if ($mount instanceof SharedMount) {
try {
$node = $mount->getShare()->getNode();
$extStorage = $node->getStorage();
$extMountPoint = $node->getMountPoint();
// This is an external storage, checking for updates
if ($extMountPoint instanceof ExternalMountPoint) {
$extRelativePath = $node->getpath();
$extInternalPath = $extMountPoint->getInternalPath($extRelativePath);
$scanner = $extStorage->getScanner($extInternalPath);
$scanner->scan($extInternalPath, Cache\Scanner::SCAN_SHALLOW);
}
} catch (\Exception $e) {}
}

if ($storage) {
$data = $this->getCacheEntry($storage, $internalPath, $relativePath);

Expand Down

0 comments on commit 446879a

Please sign in to comment.