5151use OC \Files \Storage \Storage ;
5252use OC \User \LazyUser ;
5353use OC \Share \Share ;
54- use OC \User \User ;
5554use OCA \Files_Sharing \SharedMount ;
5655use OCP \Constants ;
5756use OCP \Files \Cache \ICacheEntry ;
@@ -316,12 +315,12 @@ public function enableCacheUpdate() {
316315 $ this ->updaterEnabled = true ;
317316 }
318317
319- protected function writeUpdate (Storage $ storage , $ internalPath , $ time = null ) {
318+ protected function writeUpdate (Storage $ storage , $ internalPath , $ time = null , $ size = null ) {
320319 if ($ this ->updaterEnabled ) {
321320 if (is_null ($ time )) {
322321 $ time = time ();
323322 }
324- $ storage ->getUpdater ()->update ($ internalPath , $ time );
323+ $ storage ->getUpdater ()->update ($ internalPath , $ time, $ size );
325324 }
326325 }
327326
@@ -1175,6 +1174,7 @@ private function basicOperation($operation, $path, $hooks = [], $extraParam = nu
11751174 $ this ->unlockFile ($ path , ILockingProvider::LOCK_SHARED );
11761175 throw $ e ;
11771176 }
1177+ $ previousSize = $ storage ->filesize ($ internalPath );
11781178 }
11791179 try {
11801180 if (!is_null ($ extraParam )) {
@@ -1195,7 +1195,13 @@ private function basicOperation($operation, $path, $hooks = [], $extraParam = nu
11951195 $ this ->removeUpdate ($ storage , $ internalPath );
11961196 }
11971197 if ($ result !== false && in_array ('write ' , $ hooks , true ) && $ operation !== 'fopen ' && $ operation !== 'touch ' ) {
1198- $ this ->writeUpdate ($ storage , $ internalPath );
1198+ $ size = null ;
1199+ if ($ operation === 'mkdir ' ) {
1200+ $ size = 0 ;
1201+ } elseif ($ operation === 'file_put_contents ' && isset ($ previousSize )) {
1202+ $ size = $ result - $ previousSize ;
1203+ }
1204+ $ this ->writeUpdate ($ storage , $ internalPath , null , $ size );
11991205 }
12001206 if ($ result !== false && in_array ('touch ' , $ hooks )) {
12011207 $ this ->writeUpdate ($ storage , $ internalPath , $ extraParam );
0 commit comments