Handbuch:$wgAntivirusSetup

This page is a translated version of the page Manual:$wgAntivirusSetup and the translation is 46% complete.
Antivirus: $wgAntivirusSetup
Konfiguration für verschiedene Virenscanner.
Eingeführt in Version:1.5.0
Entfernt in Version:weiterhin vorhanden
Erlaubte Werte:nicht angegeben
Standardwert:(siehe unten)

Details

Konfiguration für verschiedene Virenscanner. 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.
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.

Standardwerte

MediaWiki Version:
1.20
$wgAntivirusSetup = [

	# Einrichtung für clamav
	'clamav' => [
		'command' => 'clamscan --no-summary ',
		'codemap' => [
			"0" => AV_NO_VIRUS, # Kein Virus
			"1" => AV_VIRUS_FOUND, # Virus wurde gefunden
			"52" => AV_SCAN_ABORTED, # Nicht unterstütztes Dateiformat (wahrscheinlich immun)
			"*" => AV_SCAN_FAILED, # else scan failed
		],
		'messagepattern' => '/.*?:(.*)/sim',
	],
];
MediaWiki Versions:
1.5 – 1.19
$wgAntivirusSetup = array(

	#Einrichtung für clamav
	'clamav' => array (
		'command' => "clamscan --no-summary ",

		'codemap' => array (
			"0" =>  AV_NO_VIRUS, # Kein Virus
			"1" =>  AV_VIRUS_FOUND, # Virus wurde gefunden
			"52" => AV_SCAN_ABORTED, # Nicht unterstütztes Dateiformat (wahrscheinlich immun)
			"*" =>  AV_SCAN_FAILED, # <span lang="en" dir="ltr" class="mw-content-ltr">else scan failed</span>
		),

		'messagepattern' => '/.*?:(.*)/sim',
	),

	#Einrichtung für f-prot
	'f-prot' => array (
		'command' => "f-prot ",

		'codemap' => array (
			"0" => AV_NO_VIRUS, # Kein Virus
			"3" => AV_VIRUS_FOUND, # Virus wurde gefunden
			"6" => AV_VIRUS_FOUND, # Virus wurde gefunden
			"*" => AV_SCAN_FAILED, # <span lang="en" dir="ltr" class="mw-content-ltr">else scan failed</span>
		),

		'messagepattern' => '/.*?Infection:(.*)$/m',
	),
);


Siehe auch