IntegrityChecker
in package
Table of Contents
Constants
- IGNORED_PATHS = [ 'cache/', // The htaccess file is included again, below 'cache/logs/', 'cache/templates_c/', 'templates/', // The default template is included again, below 'modules/', // Default modules are included again, below 'uploads/', ]
- Files with relative paths starting with a string in this array are ignored.
- INCLUDED_PATHS = ['cache/.htaccess', 'templates/DefaultRevamp', 'modules/Cookie Consent', 'modules/Core', 'modules/Discord Integration', 'modules/Forum']
- Override a path within an ignored path to be included in the scan.
Methods
- generateChecksums() : array<string|int, mixed>
- Generate checksums for files recursively, ignoring files according to IGNORED_PATHS and INCLUDED_PATHS.
- loadChecksums() : array<string|int, mixed>|null
- Load checksums from checksums.json file into an associative array.
- saveChecksums() : void
- Save checksum array to checksums file, in json format.
- verifyChecksums() : array<string|int, mixed>
- Verify code integrity, by calculating checksums for files recursively, and comparing them to checksums in the checksums file.
- checksumsPath() : string
- isIgnored() : bool
Constants
IGNORED_PATHS
Files with relative paths starting with a string in this array are ignored.
public
mixed
IGNORED_PATHS
= [
'cache/',
// The htaccess file is included again, below
'cache/logs/',
'cache/templates_c/',
'templates/',
// The default template is included again, below
'modules/',
// Default modules are included again, below
'uploads/',
]
INCLUDED_PATHS
Override a path within an ignored path to be included in the scan.
public
mixed
INCLUDED_PATHS
= ['cache/.htaccess', 'templates/DefaultRevamp', 'modules/Cookie Consent', 'modules/Core', 'modules/Discord Integration', 'modules/Forum']
Methods
generateChecksums()
Generate checksums for files recursively, ignoring files according to IGNORED_PATHS and INCLUDED_PATHS.
public
static generateChecksums() : array<string|int, mixed>
Return values
array<string|int, mixed> —An associative array (relative file path as key, checksum as value).
loadChecksums()
Load checksums from checksums.json file into an associative array.
public
static loadChecksums() : array<string|int, mixed>|null
Return values
array<string|int, mixed>|null —An associative array (relative file path as key, checksum as value) or null if the checksum file does not exist.
saveChecksums()
Save checksum array to checksums file, in json format.
public
static saveChecksums(array<string|int, mixed> $checksums) : void
Parameters
- $checksums : array<string|int, mixed>
-
An associative array (relative file path as key, checksum as value).
verifyChecksums()
Verify code integrity, by calculating checksums for files recursively, and comparing them to checksums in the checksums file.
public
static verifyChecksums() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of errors strings, empty if no issues were found.
checksumsPath()
private
static checksumsPath() : string
Return values
stringisIgnored()
private
static isIgnored(mixed $path) : bool
Parameters
- $path : mixed
Return values
bool —If the file should be ignored from integrity checking, according to IGNORED_PATHS and INCLUDED_PATHS.