@@ -82,49 +82,61 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8282 $ stats = [];
8383 foreach ($ folders as $ folder ) {
8484 $ folderId = $ folder ['id ' ];
85- $ statsRow = [$ folderId , 0 , 0 , 0 , 0 ];
86- $ mount = $ this ->mountProvider ->getMount ($ folder ['id ' ], '/ ' . $ folder ['mount_point ' ], Constants::PERMISSION_ALL , $ folder ['quota ' ]);
87- /** @var IScanner&\OC\Hooks\BasicEmitter $scanner */
88- $ scanner = $ mount ->getStorage ()->getScanner ();
89-
90- $ output ->writeln ("Scanning Team folder with id \t<info> {$ folder ['id ' ]}</info> " , OutputInterface::VERBOSITY_VERBOSE );
91- if ($ scanner instanceof ObjectStoreScanner) {
92- $ output ->writeln ('Scanning Team folders using an object store as primary storage is not supported. ' );
93- return -1 ;
85+ if ($ inputPath === '' ) {
86+ $ mounts = [
87+ 'files ' => $ this ->mountProvider ->getMount ($ folder ['id ' ], '/ ' . $ folder ['mount_point ' ], Constants::PERMISSION_ALL , $ folder ['quota ' ]),
88+ 'trashbin ' => $ this ->mountProvider ->getTrashMount ($ folder ['id ' ], '/ ' . $ folder ['mount_point ' ], $ folder ['quota ' ]),
89+ 'version ' => $ this ->mountProvider ->getVersionsMount ($ folder ['id ' ], '/ ' . $ folder ['mount_point ' ], $ folder ['quota ' ]),
90+ ];
91+ } else {
92+ $ mounts = [
93+ 'files ' => $ this ->mountProvider ->getMount ($ folder ['id ' ], '/ ' . $ folder ['mount_point ' ], Constants::PERMISSION_ALL , $ folder ['quota ' ])
94+ ];
9495 }
95-
96- $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'scanFile ' , function (string $ path ) use ($ output , &$ statsRow ): void {
97- $ output ->writeln ("\tFile \t<info>/ $ path</info> " , OutputInterface::VERBOSITY_VERBOSE );
98- $ statsRow [2 ]++;
99- // abortIfInterrupted doesn't exist in nc14
100- if (method_exists ($ this , 'abortIfInterrupted ' )) {
101- $ this ->abortIfInterrupted ();
96+ foreach ($ mounts as $ type => $ mount ) {
97+ $ statsRow = ["$ folderId - $ type " , 0 , 0 , 0 , 0 ];
98+ /** @var IScanner&\OC\Hooks\BasicEmitter $scanner */
99+ $ scanner = $ mount ->getStorage ()->getScanner ();
100+
101+ $ output ->writeln ("Scanning Team folder with id \t<info> $ folderId - $ type</info> " , OutputInterface::VERBOSITY_VERBOSE );
102+ if ($ scanner instanceof ObjectStoreScanner) {
103+ $ output ->writeln ('Scanning Team folders using an object store as primary storage is not supported. ' );
104+ return -1 ;
102105 }
103- });
104-
105- $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'scanFolder ' , function (string $ path ) use ($ output , &$ statsRow ): void {
106- $ output ->writeln ("\tFolder \t<info>/ $ path</info> " , OutputInterface::VERBOSITY_VERBOSE );
107- $ statsRow [1 ]++;
108- // abortIfInterrupted doesn't exist in nc14
109- if (method_exists ($ this , 'abortIfInterrupted ' )) {
110- $ this ->abortIfInterrupted ();
111- }
112- });
113-
114- $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'normalizedNameMismatch ' , function ($ fullPath ) use ($ output , &$ statsRow ): void {
115- $ output ->writeln ("\t<error>Entry \"" . $ fullPath . '" will not be accessible due to incompatible encoding</error> ' );
116- $ statsRow [3 ]++;
117- });
118106
119- $ start = microtime (true );
120-
121- $ scanner ->setUseTransactions (false );
122- $ scanner ->scan ($ inputPath , $ recursive );
123-
124- $ end = microtime (true );
125- $ statsRow [4 ] = date ('H:i:s ' , (int )($ end - $ start ));
126- $ output ->writeln ('' , OutputInterface::VERBOSITY_VERBOSE );
127- $ stats [] = $ statsRow ;
107+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'scanFile ' , function (string $ path ) use ($ output , &$ statsRow ): void {
108+ $ output ->writeln ("\tFile \t<info>/ $ path</info> " , OutputInterface::VERBOSITY_VERBOSE );
109+ $ statsRow [2 ]++;
110+ // abortIfInterrupted doesn't exist in nc14
111+ if (method_exists ($ this , 'abortIfInterrupted ' )) {
112+ $ this ->abortIfInterrupted ();
113+ }
114+ });
115+
116+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'scanFolder ' , function (string $ path ) use ($ output , &$ statsRow ): void {
117+ $ output ->writeln ("\tFolder \t<info>/ $ path</info> " , OutputInterface::VERBOSITY_VERBOSE );
118+ $ statsRow [1 ]++;
119+ // abortIfInterrupted doesn't exist in nc14
120+ if (method_exists ($ this , 'abortIfInterrupted ' )) {
121+ $ this ->abortIfInterrupted ();
122+ }
123+ });
124+
125+ $ scanner ->listen ('\OC\Files\Cache\Scanner ' , 'normalizedNameMismatch ' , function ($ fullPath ) use ($ output , &$ statsRow ): void {
126+ $ output ->writeln ("\t<error>Entry \"" . $ fullPath . '" will not be accessible due to incompatible encoding</error> ' );
127+ $ statsRow [3 ]++;
128+ });
129+
130+ $ start = microtime (true );
131+
132+ $ scanner ->setUseTransactions (false );
133+ $ scanner ->scan ($ inputPath , $ recursive );
134+
135+ $ end = microtime (true );
136+ $ statsRow [4 ] = date ('H:i:s ' , (int )($ end - $ start ));
137+ $ output ->writeln ('' , OutputInterface::VERBOSITY_VERBOSE );
138+ $ stats [] = $ statsRow ;
139+ }
128140 }
129141
130142 $ headers = [
0 commit comments