Skip to content
Prev Previous commit
Next Next commit
more reliable hasUpdated for s3
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Oct 15, 2021
commit 4bd08af2adf6742751aba089d28f6cb486e69e13
13 changes: 13 additions & 0 deletions apps/files_external/lib/Lib/Storage/AmazonS3.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,4 +724,17 @@ public function versioningEnabled(): bool {
}
return $this->versioningEnabled;
}

public function hasUpdated($path, $time) {
// for files we can get the proper mtime
if ($path !== '' && $object = $this->headObject($path)) {
$stat = $this->objectToMetaData($object);
return $stat['mtime'] > $time;
} else {
// for directories, the only real option we have is to do a prefix listing and iterate over all objects
// however, since this is just as expensive as just re-scanning the directory, we can simply return true
// and have the scanner figure out if anything has actually changed
return true;
}
}
}