Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
core\antivirus\scanner Class Reference

Base abstract antivirus scanner class. More...

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

Public Member Functions

 __construct ()
 Class constructor. More...
 
 get_config ($property)
 Config get method. More...
 
 get_scanning_notice ()
 Get scanning notice. More...
 
 is_configured ()
 Are the antivirus settings configured? More...
 
 message_admins ($notice)
 Email admins about antivirus scan outcomes. More...
 
 scan_data ($data)
 Scan data. More...
 
 scan_file ($file, $filename)
 Scan file. More...
 

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. More...
 

Protected Attributes

stdClass $config
 the config for antivirus
 
string $scanningnotice = ''
 scanning notice
 

Detailed Description

Base abstract antivirus scanner class.

@subpackage antivirus

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

Constructor & Destructor Documentation

◆ __construct()

core\antivirus\scanner::__construct ( )

Class constructor.

Return values
void.

Member Function Documentation

◆ get_config()

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

Config get method.

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

◆ get_scanning_notice()

core\antivirus\scanner::get_scanning_notice ( )

Get scanning notice.

Return values
string

◆ is_configured()

core\antivirus\scanner::is_configured ( )
abstract

Are the antivirus settings configured?

Return values
boolTrue if plugin has been configured.

Reimplemented in antivirus_clamav\scanner.

◆ message_admins()

core\antivirus\scanner::message_admins (   $notice)

Email admins about antivirus scan outcomes.

Parameters
string$noticeThe body of the email to be sent.
Return values
void

◆ scan_data()

core\antivirus\scanner::scan_data (   $data)

Scan data.

By default it saves data variable content to file and then scans it using scan_file method, however if antivirus plugin permits scanning data directly, the method can be overridden.

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

Reimplemented in antivirus_clamav\scanner.

◆ scan_file()

core\antivirus\scanner::scan_file (   $file,
  $filename 
)
abstract

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 constants.

Reimplemented in antivirus_clamav\scanner.

◆ set_scanning_notice()

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

Set scanning notice.

Parameters
string$noticenotice to set.
Return values
void

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