Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
MediaModerationScanFileJob
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
 run
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace MediaWiki\Extension\MediaModeration\Job;
4
5use Job;
6use MediaWiki\Extension\MediaModeration\Services\MediaModerationFileScanner;
7
8class MediaModerationScanFileJob extends Job {
9    private MediaModerationFileScanner $mediaModerationFileScanner;
10
11    public function __construct(
12        array $params,
13        MediaModerationFileScanner $mediaModerationFileScanner
14    ) {
15        parent::__construct( 'mediaModerationScanFileJob', $params );
16        $this->mediaModerationFileScanner = $mediaModerationFileScanner;
17    }
18
19    /** @inheritDoc */
20    public function run(): bool {
21        $this->mediaModerationFileScanner->scanSha1( $this->params['sha1'] );
22        // Even if the scan fails, return true as we handle the failure using the DB.
23        return true;
24    }
25}