|
|
|
@ -119,7 +119,7 @@ class Updater implements IUpdater {
|
|
|
|
|
* @param string $path
|
|
|
|
|
* @param int $time
|
|
|
|
|
*/
|
|
|
|
|
public function update($path, $time = null) {
|
|
|
|
|
public function update($path, $time = null, ?int $sizeDifference = null) {
|
|
|
|
|
if (!$this->enabled or Scanner::isPartialFile($path)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
@ -128,20 +128,22 @@ class Updater implements IUpdater {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = $this->scanner->scan($path, Scanner::SCAN_SHALLOW, -1, false);
|
|
|
|
|
if (
|
|
|
|
|
isset($data['oldSize']) && isset($data['size']) &&
|
|
|
|
|
!$data['encrypted'] // encryption is a pita and touches the cache itself
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
if (isset($data['oldSize']) && isset($data['size'])) {
|
|
|
|
|
$sizeDifference = $data['size'] - $data['oldSize'];
|
|
|
|
|
} else {
|
|
|
|
|
// scanner didn't provide size info, fallback to full size calculation
|
|
|
|
|
$sizeDifference = 0;
|
|
|
|
|
if ($this->cache instanceof Cache) {
|
|
|
|
|
$this->cache->correctFolderSize($path, $data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// encryption is a pita and touches the cache itself
|
|
|
|
|
if (isset($data['encrypted']) && !!$data['encrypted']) {
|
|
|
|
|
$sizeDifference = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// scanner didn't provide size info, fallback to full size calculation
|
|
|
|
|
if ($this->cache instanceof Cache && $sizeDifference === null) {
|
|
|
|
|
$this->cache->correctFolderSize($path, $data);
|
|
|
|
|
}
|
|
|
|
|
$this->correctParentStorageMtime($path);
|
|
|
|
|
$this->propagator->propagateChange($path, $time, $sizeDifference);
|
|
|
|
|
$this->propagator->propagateChange($path, $time, $sizeDifference ?? 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|