Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
antivirus_clamav\scanner Class Reference

Class implementing ClamAV antivirus. More...

Inheritance diagram for antivirus_clamav\scanner:
core\antivirus\scanner

Public Member Functions

 get_config ($property)
 Config get method.
 
 get_incident_details ($file='', $filename='', $notice='', $virus=true)
 Return incident details.
 
 get_messages ()
 Getter method for messages queued by the antivirus scanner.
 
 get_scanning_notice ()
 Get scanning notice.
 
 get_virus_found_message ()
 Getter method for the antivirus message displayed in the exception.
 
 is_configured ()
 Are the necessary antivirus settings configured?
 
 message_admins ($notice, $format=FORMAT_PLAIN, $eventname='errors')
 This function pushes given messages into the message queue, which will be sent by the antivirus manager.
 
 scan_data ($data)
 Scan data.
 
 scan_file ($file, $filename)
 Scan file.
 
 scan_file_execute_commandline ($file)
 Scan file using command line utility.
 
 scan_file_execute_socket ($file, $type)
 Scan file using sockets.
 

Public Attributes

const SCAN_RESULT_ERROR = 2
 Scanning result indicating the error.
 
const SCAN_RESULT_FOUND = 1
 Scanning result indicating that virus is found.
 
const SCAN_RESULT_OK = 0
 Scanning result indicating no virus found.
 

Protected Member Functions

 set_scanning_notice ($notice)
 Set scanning notice.
 

Protected Attributes

stdClass $config
 the config for antivirus
 
array $messages = []
 any admin messages generated by a plugin.
 
string $scanningnotice = ''
 scanning notice
 

Detailed Description

Class implementing ClamAV antivirus.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ get_config()

core\antivirus\scanner::get_config ( $property)
inherited

Config get method.

Parameters
string$propertyconfig property to get.
Return values
mixed
Exceptions
coding_exception

◆ get_incident_details()

core\antivirus\scanner::get_incident_details ( $file = '',
$filename = '',
$notice = '',
$virus = true )
inherited

Return incident details.

Parameters
string$filefull path to the file
string$filenameoriginal name of the file
string$noticenotice from antivirus
string$virusif this template is due to a virus found.
Return values
stringthe incident details
Exceptions
coding_exception

◆ get_messages()

core\antivirus\scanner::get_messages ( )
inherited

Getter method for messages queued by the antivirus scanner.

Return values
array

◆ get_scanning_notice()

core\antivirus\scanner::get_scanning_notice ( )
inherited

Get scanning notice.

Return values
string

◆ get_virus_found_message()

core\antivirus\scanner::get_virus_found_message ( )
inherited

Getter method for the antivirus message displayed in the exception.

Return values
arrayarray of string and component to pass to exception constructor.

◆ is_configured()

antivirus_clamav\scanner::is_configured ( )

Are the necessary antivirus settings configured?

Return values
boolTrue if all necessary config settings been entered

Reimplemented from core\antivirus\scanner.

◆ message_admins()

core\antivirus\scanner::message_admins ( $notice,
$format = FORMAT_PLAIN,
$eventname = 'errors' )
inherited

This function pushes given messages into the message queue, which will be sent by the antivirus manager.

Parameters
string$noticeThe body of the email to be sent.
string$formatThe body format.
string$eventnameevent name
Return values
void
Exceptions
coding_exception
moodle_exception

◆ scan_data()

antivirus_clamav\scanner::scan_data ( $data)

Scan data.

Parameters
string$dataThe variable containing the data to scan.
Return values
intScanning result constant.

Reimplemented from core\antivirus\scanner.

◆ scan_file()

antivirus_clamav\scanner::scan_file ( $file,
$filename )

Scan file.

This method is normally called from antivirus manager (core\antivirus\manager\scan_file).

Parameters
string$fileFull path to the file.
string$filenameName of the file (could be different from physical file if temp file is used).
Return values
intScanning result constant.

Reimplemented from core\antivirus\scanner.

◆ scan_file_execute_commandline()

antivirus_clamav\scanner::scan_file_execute_commandline ( $file)

Scan file using command line utility.

Parameters
string$fileFull path to the file.
Return values
intScanning result constant.

◆ scan_file_execute_socket()

antivirus_clamav\scanner::scan_file_execute_socket ( $file,
$type )

Scan file using sockets.

Parameters
string$fileFull path to the file.
string$typeEither 'tcpsocket' or 'unixsocket'
Return values
intScanning result constant.

◆ set_scanning_notice()

core\antivirus\scanner::set_scanning_notice ( $notice)
protectedinherited

Set scanning notice.

Parameters
string$noticenotice to set.
Return values
void

The documentation for this class was generated from the following file: