Symbiote\SteamedClams\ClamAVEmulator
For emulating/faking ClamAV results
This was implemented so Windows users and inexperienced developers can
focus on the logic surrounding the ClamAV daemon, without needing to
know how install it.
Synopsis
class ClamAVEmulator
extends ClamAV
{
- // constants
- const MODE_UNKNOWN = 0;
- const MODE_NO_VIRUS = 1;
- const MODE_HAS_VIRUS = 2;
- const MODE_OFFLINE = 3;
- // Inherited constants from ClamAV
- const MODULE_DIR = 'steamedclams';
- const OFFLINE = false;
- // members
- private static int $mode = self::MODE_UNKNOWN;
- private static string $emulate_version = 'ClamAV 0.99.2/22585/Wed Nov 23 00:21:08 2016';
- // Inherited members from ClamAV
- protected ClamdBase $clamd_instance;
- protected ClamdException $last_exception;
- protected boolean|null $_cache_isOffline;
- // methods
- public void version()
- protected void fileScan()
- protected void modeUnknown()
- protected void modeOffline()
- protected void modeInvalid()
- // Inherited methods from ClamAV
- public ClamAVScan|null scanFileRecordForVirus()
- public boolean|null beforeHandleMissingFile()
- public ClamAVScan|null scanFileForVirus()
- protected array|false fileScan()
- protected ClamdBase getClamd()
- protected void setLastExceptionAndLog()
- protected string getIP()
- public boolean|null afterHandleMissingFile()
- public DataList|Arraylist getInitialFileToScanList()
- public DataList getBaseFileList()
- public ArrayList|DataList getFailedToScanFileList()
- public boolean isOffline()
- public string version()
- public ClamdException getLastException()
Hierarchy
Extends
Constants
Name | Value |
---|---|
MODE_UNKNOWN | 0 |
MODE_NO_VIRUS | 1 |
MODE_HAS_VIRUS | 2 |
MODE_OFFLINE | 3 |
MODULE_DIR | 'steamedclams' |
OFFLINE | false |
Members
private
- $emulate_version
—
string
The version string to return when emulating. - $mode
—
int
The state of ClamAV to fake
protected
- $_cache_isOffline — Symbiote\SteamedClams\boolean|null
- $clamd_instance — \ClamdBase
- $last_exception — \ClamdException
Methods
protected
- fileScan() — {@inheritDoc}
- modeInvalid()
- modeOffline()
- modeUnknown()
public
- version() — {@inheritDoc}
Inherited from Symbiote\SteamedClams\ClamAV
protected
- fileScan() — Scan for virus, return array() if ClamAV daemon is running and returns false if it is not (or an error occurred connecting to the socket)
- getClamd() — Return underlying Clamd implementation.
- getIP() — Get the current users IP address
- setLastExceptionAndLog() — Set exception, if it has a non-falsey value, log it.
public
- afterHandleMissingFile() — If file didn't exist on local machine and downloaded from CDN, we want to re-remove it.
- beforeHandleMissingFile() — If file doesn't exist on local machine, try to download from a CDN module or similar.
- getBaseFileList()
- getFailedToScanFileList() — Get list of files that couldn't be scanned when uploaded due to ClamAV daemon being down or not properly configured ie. after installation of module
- getInitialFileToScanList() — Get list of files that haven't been checked at all.
- getLastException() — Get the last exception caught by this.
- isOffline()
- scanFileForVirus()
- scanFileRecordForVirus()
- version()