mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-19 01:55:08 +00:00
dc0937fda1
A backfill runs for minutes or hours inside a queue worker, where none of it is visible. The third tab polls every four seconds and says what is happening: whether anything is running, how many uploads are held, how deep the queue is, how many files were checked in the last hour, and the last twenty verdicts with what each one was. When nothing is running, that same list is the record of the last run, which is what somebody opening the tab after the fact came for. Two things the live screen found that the tests had not: **A backfill read as "nothing is being scanned."** Re-scanning a file that already went out unchecked deliberately leaves it available, so it is never "pending" — and the screen counted only pending files. It counts the scans queue too, and the two are shown separately, because "an upload nobody can download yet" and "work the scanner has not reached" are different facts. **A file whose bytes are missing was recorded as "the scanner could not be reached."** Wrong on screen, and worse than wrong in behaviour: that is the one reason the hourly sweep re-queues, so every orphaned row would have been rescanned every hour forever. It has its own reason now, and goes through the same policy as a file the scanner could not open. Both tabs also gained the header shortcut to Quarantine, and Quarantine one back to the settings, each shown only to somebody the destination will actually let in.
48 lines
1.7 KiB
PHP
48 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Files\Scanning;
|
|
|
|
/**
|
|
* Why a file carries ScanStatus::NotScanned — stored in `scan_note`.
|
|
*
|
|
* Four different things to say to a person, and two of them are the
|
|
* installation's own doing rather than the file's, so a single "not
|
|
* scanned" badge with no reason would be unactionable.
|
|
*/
|
|
enum NotScannedReason: string
|
|
{
|
|
/** Bigger than the largest file this installation scans. */
|
|
case TooLarge = 'too_large';
|
|
|
|
/** An encrypted archive or document the scanner cannot open. */
|
|
case Encrypted = 'encrypted';
|
|
|
|
/** The scanner could not be reached in time, and the policy lets files through. */
|
|
case ScannerUnavailable = 'scanner_unavailable';
|
|
|
|
/** Uploaded before scanning was switched on, or while it is off. */
|
|
case BeforeScanning = 'before_scanning';
|
|
|
|
/**
|
|
* The bytes were not there to read — an orphaned row, or storage that
|
|
* has moved. Its own reason rather than "the scanner could not be
|
|
* reached", which is what it used to say: that reading is both wrong
|
|
* on screen and wrong in behaviour, because the hourly sweep retries
|
|
* an unreachable scanner and would have retried these forever.
|
|
*/
|
|
case Unreadable = 'unreadable';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::TooLarge => 'Too large to scan',
|
|
self::Encrypted => 'Encrypted, so it could not be scanned',
|
|
self::ScannerUnavailable => 'The scanner could not be reached',
|
|
self::BeforeScanning => 'Uploaded before virus scanning was switched on',
|
|
self::Unreadable => 'The file itself could not be read from storage',
|
|
};
|
|
}
|
|
}
|