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