Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Quarantine file

Author: Nathan Nguyen <nathannguyen@catalyst-au.net>
Copyright: Catalyst IT
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 326 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: quarantine  - X-Ref

Quarantine file

quarantine_file(string $file, string $filename, string $incidentdetails, string $notice)   X-Ref
Move the infected file to the quarantine folder.

param: string $file infected file.
param: string $filename infected file name.
param: string $incidentdetails incident details.
param: string $notice notice details.
return: string|null the name of the newly created quarantined file.

quarantine_data(string $data, string $filename, string $incidentdetails, string $notice)   X-Ref
Move the infected file to the quarantine folder.

param: string $data data which is infected.
param: string $filename infected file name.
param: string $incidentdetails incident details.
param: string $notice notice details.
return: string|null the name of the newly created quarantined file.

is_quarantine_enabled()   X-Ref
Check if the virus quarantine is allowed

return: bool

get_quarantine_folder()   X-Ref
Get quarantine folder

return: string path of quarantine folder

quarantined_file_exists(string $filename)   X-Ref
Checks whether a file exists inside the antivirus quarantine folder.

param: string $filename the filename to check.
return: boolean whether file exists.

download_quarantined_file(int $fileid)   X-Ref
Download quarantined file.

param: int $fileid the id of file to be downloaded.

delete_quarantined_file(int $fileid)   X-Ref
Delete quarantined file.

param: int $fileid id of file to be deleted.

download_all_quarantined_files()   X-Ref
Download all quarantined files.

return: void

get_quarantined_files()   X-Ref
Return array of quarantined files.

return: array list of quarantined files.

clean_up_quarantine_folder(int $timetocleanup)   X-Ref
Clean up quarantine folder

param: int $timetocleanup time to clean up

clean_up_infected_records(int $timetocleanup)   X-Ref
This function removes any stale records from the infected files table.

param: int $timetocleanup the time to cleanup from
return: void

create_infected_file_record(string $filename, string $zipfile, string $reason)   X-Ref
Create an infected file record

param: string $filename original file name
param: string $zipfile quarantined file name
param: string $reason failure reason

delete_infected_file_record(int $fileid)   X-Ref
Delete the database record for an infected file.

param: int $fileid quarantined file id