1 | <?php |
||
16 | class Status { |
||
17 | |||
18 | /* |
||
19 | * The file was not checked (e.g. because the AV daemon wasn't running). |
||
20 | */ |
||
21 | const SCANRESULT_UNCHECKED = -1; |
||
22 | |||
23 | /* |
||
24 | * The file was checked and found to be clean. |
||
25 | */ |
||
26 | const SCANRESULT_CLEAN = 0; |
||
27 | |||
28 | /* |
||
29 | * The file was checked and found to be infected. |
||
30 | */ |
||
31 | const SCANRESULT_INFECTED = 1; |
||
32 | |||
33 | /* |
||
34 | * Should be SCANRESULT_UNCHECKED | SCANRESULT_INFECTED | SCANRESULT_CLEAN |
||
35 | */ |
||
36 | protected $numericStatus; |
||
37 | |||
38 | /* |
||
39 | * Virus name or error message |
||
40 | */ |
||
41 | protected $details = ""; |
||
42 | |||
43 | protected $ruleMapper; |
||
44 | |||
45 | 10 | public function __construct() { |
|
46 | 10 | $this->numericStatus = self::SCANRESULT_UNCHECKED; |
|
47 | 10 | $this->ruleMapper = new Db\RuleMapper(\OC::$server->getDb()); |
|
48 | 10 | } |
|
49 | |||
50 | /** |
||
51 | * Get scan status as integer |
||
52 | * |
||
53 | * @return int |
||
54 | */ |
||
55 | 8 | public function getNumericStatus() { |
|
56 | 8 | return $this->numericStatus; |
|
57 | } |
||
58 | |||
59 | /** |
||
60 | * Get scan status as string |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | 4 | public function getDetails() { |
|
65 | 4 | return $this->details; |
|
66 | } |
||
67 | |||
68 | /** |
||
69 | * @param string $rawResponse |
||
70 | * @param integer $result |
||
71 | */ |
||
72 | 8 | public function parseResponse($rawResponse, $result = null) { |
|
133 | |||
134 | 5 | protected function getResponseRules() { |
|
135 | 5 | $infectedRules = $this->ruleMapper->findAllMatchedByStatus(self::SCANRESULT_INFECTED); |
|
136 | 5 | $uncheckedRules = $this->ruleMapper->findAllMatchedByStatus(self::SCANRESULT_UNCHECKED); |
|
147 | |||
148 | public function dispatch($item, $isBackground = false) { |
||
161 | } |
||
162 |