Antivirus: $wgAntivirusSetup | |
---|---|
Configuration for different virus scanners. |
|
Introduced in version: | 1.5.0 |
Removed in version: | still in use |
Allowed values: | Unspecified |
Default value: | (see below) |
Other settings: Alphabetical | By function |
Details
Configuration for different virus scanners. This is an associative array of associative arrays: it contains one setup array per known scanner type. The entry is selected by $wgAntivirus
, i.e. valid values for $wgAntivirus are the keys defined in this array. The antivirus functions may not work on Windows in MediaWiki versions before 1.16.0.The configuration array for each scanner contains the following keys:
command
- The full command to call the virus scanner - %f will be replaced with the name of the file to scan. If not present, the filename will be appended to the command.
- Note that this must be overwritten if the scanner is not in the system path; in that case, you should set
$wgAntivirusSetup[$wgAntivirus]['command']
to the desired command with full path. (This line should appear after the line that sets $wgAntivirus.) codemap
- A mapping of exit code to return codes of the
detectVirus()
function in "SpecialUpload.php".- An exit code mapped to
AV_SCAN_FAILED
causes the function to consider the scan to be failed. This will pass the file if $wgAntivirusRequired is not set. - An exit code mapped to
AV_SCAN_ABORTED
causes the function to consider the file to have an unsupported format, which is probably immune to viruses. This causes the file to pass. - An exit code mapped to
AV_NO_VIRUS
will cause the file to pass, meaning no virus was found. - All other codes (like
AV_VIRUS_FOUND
) will cause the function to report a virus.
- An exit code mapped to
- You may use
"*"
as a key in the array to catch all exit codes not mapped otherwise. messagepattern
- A Perl regular expression to extract the meaningful part of the scanner's output. The relevant part should be matched as group one (
\1
). - If not defined or the pattern does not match, the full message is shown to the user.
Default values
MediaWiki version: | ≥ 1.20 |
$wgAntivirusSetup = [
# <translate><!--T:26--> setup for clamav</translate>
'clamav' => [
'command' => 'clamscan --no-summary ',
'codemap' => [
"0" => AV_NO_VIRUS, # <translate nowrap><!--T:27--> no virus</translate>
"1" => AV_VIRUS_FOUND, # <translate nowrap><!--T:28--> virus found</translate>
"52" => AV_SCAN_ABORTED, # <translate nowrap><!--T:29--> unsupported file format (probably immune)</translate>
"*" => AV_SCAN_FAILED, # <translate nowrap><!--T:30--> else scan failed</translate>
],
'messagepattern' => '/.*?:(.*)/sim',
],
];
MediaWiki versions: | 1.5 – 1.19 |
$wgAntivirusSetup = array(
#<translate><!--T:31--> setup for clamav</translate>
'clamav' => array (
'command' => "clamscan --no-summary ",
'codemap' => array (
"0" => AV_NO_VIRUS, # <translate><!--T:32--> no virus</translate>
"1" => AV_VIRUS_FOUND, # <translate><!--T:33--> virus found</translate>
"52" => AV_SCAN_ABORTED, # <translate><!--T:34--> unsupported file format (probably imune)</translate>
"*" => AV_SCAN_FAILED, # <translate><!--T:35--> else scan failed</translate>
),
'messagepattern' => '/.*?:(.*)/sim',
),
#<translate><!--T:36--> setup for f-prot</translate>
'f-prot' => array (
'command' => "f-prot ",
'codemap' => array (
"0" => AV_NO_VIRUS, # <translate><!--T:37--> no virus</translate>
"3" => AV_VIRUS_FOUND, # <translate><!--T:38--> virus found</translate>
"6" => AV_VIRUS_FOUND, # <translate><!--T:39--> virus found</translate>
"*" => AV_SCAN_FAILED, # <translate><!--T:40--> else scan failed</translate>
),
'messagepattern' => '/.*?Infection:(.*)$/m',
),
);
See also
- $wgAntivirus
- $wgAntivirusRequired
- ClamAV (the configured antivirus in default configuration) on English Wikipedia
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.