Integrity Checks

Integrity checks verify that WordPress core files match the official checksums. RunIntegrityChecks command dispatches IntegrityCheckJob per site; IntegrityCheckService::run() executes wp core verify-checksums and records the result. Modified files can be excluded via config (e.g. patched l10n.php).

Flow

flowchart LR Cmd[RunIntegrityChecks] --> Job[IntegrityCheckJob] Job --> Svc[IntegrityCheckService] Svc --> WP[wp core verify-checksums] WP --> Record[IntegrityCheckRun] Svc --> Alert[AlertManager on failure]

Implementation

IntegrityCheckService::run(Site):

  1. Builds command: wp core verify-checksums --format=json. If wphoster.integrity.exclude_files is set (comma-separated), adds --exclude=....
  2. Runs process in site.root_path with configured timeout.
  3. Exit 0 → create IntegrityCheckRun with status=passed.
  4. Exit non-zero → parse JSON output for failed files, create run with status=failed and failed_files JSON, then raise alert via AlertManager.

Key files

PathPurpose
app/Services/Integrity/IntegrityCheckService.phpRun checks, parse output, record and alert
app/Jobs/IntegrityCheckJob.phpQueue job
app/Console/Commands/RunIntegrityChecks.phpArtisan command
app/Models/IntegrityCheckRun.phpModel for run history

Config

KeyPurpose
wphoster.integrity.exclude_filesComma-separated paths to exclude (e.g. wp-includes/l10n.php)
wphoster.integrity.alert_severitySeverity when checks fail (default warning)

Scheduling

wphoster:run-integrity-checks runs daily at 06:00 (routes/console.php).