◆ __construct()
ilVirusScannerICapClient::__construct |
( |
string |
$scan_command, |
|
|
string |
$clean_command |
|
) |
| |
◆ buildScanCommandArguments()
ilVirusScannerICapClient::buildScanCommandArguments |
( |
string |
$file = '-' | ) |
|
|
protected |
◆ scanFile()
ilVirusScannerICapClient::scanFile |
( |
string |
$file_path, |
|
|
string |
$org_name = "" |
|
) |
| |
Definition at line 36 of file class.ilVirusScannerICapClient.php.
References $out, buildScanCommandArguments(), ilShellUtil\escapeShellArg(), ilShellUtil\escapeShellCmd(), and ilShellUtil\execQuoted().
39 if (file_exists($file_path)) {
40 if (is_readable($file_path)) {
41 $file_path = realpath($file_path);
46 $timeout = preg_grep(
'/failed\/timedout.*/',
$out);
47 $virus_detected = preg_grep(
'/' . self::HEADER_INFECTION_FOUND .
'.*/',
$out);
48 if (is_array($virus_detected) && count($virus_detected) > 0) {
49 $return_string = sprintf(
'Virus detected in %s', $file_path);
50 $this->log->warning($return_string);
52 } elseif (is_array($timeout) && count($timeout) > 0) {
53 $return_string =
'Cannot connect to icap server.';
54 $this->log->warning($return_string);
56 $this->scanResult = implode(
"\n",
$out);
58 $return_string = sprintf(
'File "%s" not readable.', $file_path);
59 $this->log->info($return_string);
62 $return_string = sprintf(
'File "%s" not found.', $file_path);
63 $this->log->info($return_string);
66 $this->log->info(sprintf(
'No virus found in file "%s".', $file_path));
68 return $return_string;
buildScanCommandArguments(string $file='-')
static escapeShellArg(string $a_arg)
static execQuoted(string $cmd, ?string $args=null)
static escapeShellCmd(string $a_arg)
◆ HEADER_INFECTION_FOUND
const ilVirusScannerICapClient::HEADER_INFECTION_FOUND = 'X-Infection-Found' |
|
private |
The documentation for this class was generated from the following file: