Processor registry
Processors run at upload time. Each processor inspects the uploaded file (stream or temp path) and either annotates the DownloadFile row, rejects the upload, or both. The registry holds an ordered chain. ProcessorChain runs every processor and aggregates the results.
| Key | Value |
|---|---|
| Container key | mc_dm.processor_registry |
| Event | mc_dm_processor_handlers |
Built-in processors
| ID | Class | What it does |
|---|---|---|
hash | HashProcessor | Computes SHA-256 of the file. Stores it on DownloadFile.hash_sha256. |
size | SizeProcessor | Records file size in bytes. |
mime | MimeProcessor | Detects MIME type from content (not extension). |
magic_byte | MagicByteProcessor | Validates the file signature against the category's allowed types. |
decompression_bomb | DecompressionBombProcessor | Rejects ZIP, RAR, and 7z archives that decompress to absurd ratios. |
Interface
namespace MC\DownloadsManager\Processor;
interface FileProcessor
{
public function process(DownloadFile $file, string $tempPath): ProcessorResult;
}
ProcessorResult carries pass or reject plus optional annotations to merge onto the DownloadFile entity (hash, size, detected mime, etc.).
Wiring an adapter
public static function processorHandlers(ProcessorRegistry $registry)
{
$registry->register('your_processor', new YourAddon\Processor\YourProcessor());
}
A rejecting processor causes the upload to fail with HTTP 422 from the Files API and a phrase-keyed error in the public UI.