1 | <?php |
||
16 | class Local extends ScannerBase{ |
||
17 | |||
18 | /** |
||
19 | * @var string |
||
20 | */ |
||
21 | protected $avPath; |
||
22 | |||
23 | /** |
||
24 | * STDIN and STDOUT descriptors |
||
25 | * @var array of resources |
||
26 | */ |
||
27 | private $pipes = []; |
||
28 | |||
29 | /** |
||
30 | * Process handle |
||
31 | * @var resource |
||
32 | */ |
||
33 | private $process; |
||
34 | |||
35 | 1 | public function __construct(AppConfig $config, ILogger $logger, StatusFactory $statusFactory) { |
|
36 | 1 | parent::__construct($config, $logger, $statusFactory); |
|
37 | |||
38 | // get the path to the executable |
||
39 | 1 | $this->avPath = escapeshellcmd($this->appConfig->getAvPath()); |
|
40 | |||
41 | // check that the executable is available |
||
42 | 1 | if (!file_exists($this->avPath)) { |
|
43 | 1 | throw new \RuntimeException('The antivirus executable could not be found at ' . $this->avPath); |
|
44 | } |
||
45 | } |
||
46 | |||
47 | public function initScanner(){ |
||
63 | |||
64 | protected function shutdownScanner(){ |
||
76 | } |
||
77 |
If you suppress an error, we recommend checking for the error condition explicitly: