|
18 | 18 | use OCP\Files\Cache\ICache; |
19 | 19 | use OCP\Files\Cache\ICacheEntry; |
20 | 20 | use OCP\Files\Cache\IScanner; |
| 21 | +use OCP\Files\Cache\IUpdater; |
21 | 22 | use OCP\Files\FileInfo; |
22 | 23 | use OCP\Files\GenericFileException; |
23 | 24 | use OCP\Files\NotFoundException; |
@@ -474,6 +475,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int { |
474 | 475 | } |
475 | 476 | // update stat with new data |
476 | 477 | $mTime = time(); |
| 478 | + $oldSize = $stat['size'] ?? 0; |
477 | 479 | $stat['size'] = (int)$size; |
478 | 480 | $stat['mtime'] = $mTime; |
479 | 481 | $stat['storage_mtime'] = $mTime; |
@@ -571,6 +573,9 @@ public function writeStream(string $path, $stream, ?int $size = null): int { |
571 | 573 | } |
572 | 574 | } |
573 | 575 |
|
| 576 | + $this->getUpdater()->correctParentStorageMtime($path); |
| 577 | + $this->propagator->propagateChange($path, $mTime, $stat['size'] - $oldSize); |
| 578 | + |
574 | 579 | return $size; |
575 | 580 | } |
576 | 581 |
|
@@ -824,4 +829,18 @@ public function cancelChunkedWrite(string $targetPath, string $writeToken): void |
824 | 829 | public function setPreserveCacheOnDelete(bool $preserve) { |
825 | 830 | $this->preserveCacheItemsOnDelete = $preserve; |
826 | 831 | } |
| 832 | + |
| 833 | + public function getUpdater(?IStorage $storage = null): IUpdater { |
| 834 | + if (!$storage) { |
| 835 | + $storage = $this; |
| 836 | + } |
| 837 | + if (!$storage->instanceOfStorage(self::class)) { |
| 838 | + throw new \InvalidArgumentException('Storage is not of the correct class'); |
| 839 | + } |
| 840 | + /** @var self $storage */ |
| 841 | + if (!isset($storage->updater)) { |
| 842 | + $storage->updater = new ObjectStoreUpdater($storage); |
| 843 | + } |
| 844 | + return $storage->updater; |
| 845 | + } |
827 | 846 | } |
0 commit comments