diff options
author | Louis Chemineau <louis@chmn.me> | 2025-05-13 18:23:39 +0200 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2025-05-13 18:23:39 +0200 |
commit | 4d2c10f6feac330a40d26d3ef6132ff2a9f5dd99 (patch) | |
tree | 6548af440ff2b5b3f3bc40792349b938975b8ea3 | |
parent | f26dc79480e75b0dc2f80c9dfc08fada0f6beb68 (diff) | |
download | nextcloud-server-artonge/feat/forward_sizeDifference_on_write.tar.gz nextcloud-server-artonge/feat/forward_sizeDifference_on_write.zip |
feat: Forward sizeDifference on writeartonge/feat/forward_sizeDifference_on_write
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r-- | lib/private/Files/View.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index bbad24d3e43..56608994c01 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -1222,9 +1222,16 @@ class View { $this->removeUpdate($storage, $internalPath); } if ($result !== false && in_array('write', $hooks, true) && $operation !== 'fopen' && $operation !== 'touch') { - $isCreateOperation = $operation === 'mkdir' || ($operation === 'file_put_contents' && in_array('create', $hooks, true)); - $sizeDifference = $operation === 'mkdir' ? 0 : $result; - $this->writeUpdate($storage, $internalPath, null, $isCreateOperation ? $sizeDifference : null); + if ($operation === 'mkdir') { + $sizeDifference = 0; + } else if ($operation === 'file_put_contents' && in_array('create', $hooks, true)) { + $sizeDifference = $result; + } else { + $cacheData = $storage->getCache()->get($path); + $sizeDifference = $cacheData === false ? null : null;//$result - $cacheData->getSize(); + } + + $this->writeUpdate($storage, $internalPath, null, $sizeDifference); } if ($result !== false && in_array('touch', $hooks)) { $this->writeUpdate($storage, $internalPath, $extraParam, 0); |