@@ -237,6 +237,12 @@ public function scan(string $dir = '', $recursive = \OC\Files\Cache\Scanner::SCA
237237 $ this ->eventDispatcher ->dispatchTyped (new NodeAddedToCache ($ storage , $ path ));
238238 }
239239 });
240+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'postScanFile ' , function ($ file , $ storageId ) use ($ storage ): void {
241+ $ this ->postProcessEntry ($ storage );
242+ });
243+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'postScanFolder ' , function ($ path , $ storageId ) use ($ storage ): void {
244+ $ this ->postProcessEntry ($ storage );
245+ });
240246
241247 if (!$ storage ->file_exists ($ relativePath )) {
242248 throw new NotFoundException ($ dir );
@@ -278,10 +284,14 @@ private function triggerPropagator(IStorage $storage, $internalPath) {
278284 $ storage ->getPropagator ()->propagateChange ($ internalPath , time ());
279285 }
280286
281- private function postProcessEntry (IStorage $ storage , $ internalPath ) {
282- $ this ->triggerPropagator ($ storage , $ internalPath );
287+ private function postProcessEntry (IStorage $ storage , ?string $ internalPath = null ): void {
288+ if ($ internalPath !== null ) {
289+ $ this ->triggerPropagator ($ storage , $ internalPath );
290+ }
283291 if ($ this ->useTransaction ) {
284- $ this ->entriesToCommit ++;
292+ if ($ internalPath !== null ) {
293+ $ this ->entriesToCommit ++;
294+ }
285295 if ($ this ->entriesToCommit >= self ::MAX_ENTRIES_TO_COMMIT
286296 || $ this ->transactionStartTime + self ::TRANSACTION_SECOND_TIMEOUT <= $ this ->timeFactory ->getTime ()
287297 ) {
0 commit comments