Files
argus-wp-defence/includes/class-argus-activator.php
ARGUSandClaude Sonnet 5 35efd3e485 ARGUS WordPress Defence 7.23.0
Real changes since 1.0.0, all live-verified before this release:

- Firewall: rule corpus expanded 19 -> 43 rules, real OWASP-CRS-equivalent
  coverage (XXE, SSRF, session fixation, Log4Shell/JNDI, scanner-tool
  detection, deeper SQL injection/XSS/PHP-injection).
- Fixed a real bug: a quarantined file's severity badge and its content
  analysis score could disagree with no explanation (e.g. a benign file
  showing CRITICAL next to Score 0); both are now derived consistently
  and shown together.
- ARGUS now always keeps itself updated, and can optionally do the same
  for every other installed plugin and theme (Settings, on by default) --
  uses WordPress's own native update system, nothing custom.
- Global Threat Intelligence is now opt-in, not automatic -- a single
  click on its own page, with an honest, specific description of exactly
  what's shared (an IP address, a reason code, a confidence score, a
  country). Previously connected automatically on activation.
- New first-run Welcome screen after activation: confirms what's already
  protecting the site, and surfaces the few real optional choices in one
  place.
- Dashboard: running version now visible in the header; new "IPs
  Tracked" and "ANIS Protections" metrics.
- Full WordPress.org Plugin Directory readiness audit performed against
  this codebase. Two real compliance issues found and fixed (see above:
  Global Threat Intelligence's default, and the self-update mechanism,
  which is excluded from this build entirely -- WordPress.org prohibits
  a plugin from using any update channel other than its own, even an
  inert one). This release is still self-distributed, not a WordPress.org
  submission -- that remains a future step.

Verified before publishing: this exact ZIP was installed, activated (14
admin pages loaded clean, zero PHP errors/warnings), and uninstalled
(zero leftover database tables or options) in a fresh, disposable
WordPress + MySQL environment.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 19:08:02 +00:00

70 lines
2.4 KiB
PHP

<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Argus_Activator {
public static function activate() {
require_once ARGUS_WPD_DIR . 'includes/class-argus-db.php';
Argus_DB::install();
require_once ARGUS_WPD_DIR . 'includes/class-argus-mu-installer.php';
Argus_MU_Installer::install();
require_once ARGUS_WPD_DIR . 'includes/class-argus-malware-scanner.php';
Argus_Malware_Scanner::ensure_uploads_lockdown();
self::schedule_cron();
require_once ARGUS_WPD_DIR . 'includes/class-argus-anis-client.php';
require_once ARGUS_WPD_DIR . 'includes/class-argus-ban-engine.php';
require_once ARGUS_WPD_DIR . 'includes/class-argus-events.php';
if ( Argus_ANIS_Client::is_enabled() ) {
$result = Argus_ANIS_Client::register();
if ( $result['success'] ) {
Argus_ANIS_Client::scheduled_sync();
}
}
require_once ARGUS_WPD_DIR . 'includes/class-argus-vuln-intel.php';
require_once ARGUS_WPD_DIR . 'includes/class-argus-findings.php';
require_once ARGUS_WPD_DIR . 'includes/class-argus-explain.php';
if ( Argus_Settings::get( 'vuln_intel_enabled', true ) ) {
Argus_Vuln_Intel::scheduled_check();
}
update_option( 'argus_wpd_activated_at', current_time( 'mysql', true ), false );
// Argus_License exists only in the separately-distributed Premium
// build (excluded from the WordPress.org release, see
// bin/build-release.sh) -- the free build has no trial timer at all.
if ( class_exists( 'Argus_License' ) ) {
Argus_License::ensure_trial_started();
}
// Redirect to the Welcome screen on the very next admin_init --
// Argus_Admin::maybe_redirect_to_welcome() is the one that decides
// whether this was a real single-plugin activation vs. a bulk-activate
// or network-wide multisite activation (neither of which should
// hijack the admin's next page load), and clears this either way.
set_transient( 'argus_wpd_do_activation_redirect', 1, MINUTE_IN_SECONDS );
}
protected static function schedule_cron() {
add_filter( 'cron_schedules', array( 'Argus_Plugin', 'register_cron_schedules' ) ); // phpcs:ignore WordPress.WP.CronInterval
if ( ! wp_next_scheduled( 'argus_wpd_hourly' ) ) {
wp_schedule_event( time(), 'hourly', 'argus_wpd_hourly' );
}
if ( ! wp_next_scheduled( 'argus_wpd_daily' ) ) {
wp_schedule_event( time(), 'daily', 'argus_wpd_daily' );
}
if ( ! wp_next_scheduled( 'argus_wpd_five_minutes' ) ) {
wp_schedule_event( time(), 'argus_wpd_five_minutes', 'argus_wpd_five_minutes' );
}
}
}