nextcloud / files_antivirus

👾 Antivirus app for Nextcloud Files
https://apps.nextcloud.com/apps/files_antivirus
GNU Affero General Public License v3.0
86 stars 36 forks source link

Add command to scan all files #70

Open rullzer opened 6 years ago

rullzer commented 6 years ago

I think it would make sense to add a cli command as well to scan all files.

The scanning could do the same as the backgroundjob (just scan files that are new or have been modified).

Maybe a force flag to force a rescan. If for example virus definitions are updated.

loelkes commented 8 months ago

A slightly related issue is that the background scan does not scan all files. This is because the number of unscanned files detected on each run is hard coded to 1000 on the CLI and 100 in the background job, regardless of the maximum value set. This value only applies to the files to be scanned, not the files to be detected.

Problem: I have an instance with > 10 million files. At an interval of 100 files (background job) every 15 minutes (hard coded), it would take almost 3 years to scan everything just once. If I run the job manually every 5min on 1000 files, it only takes a month. Still too much.

The results for unscanned files are set to a batch size (?) in line 213

https://github.com/nextcloud/files_antivirus/blob/f51714aa3b0f84667a86048d4e3ef95c35c30c35/lib/BackgroundJob/BackgroundScanner.php#L202-L219

which is limited to 100 in the background job and 1000 in the CLI.

https://github.com/nextcloud/files_antivirus/blob/f51714aa3b0f84667a86048d4e3ef95c35c30c35/lib/BackgroundJob/BackgroundScanner.php#L173-L182

Why?