includes/Core/class-activate.php
Activate class for the PerformanceOptimise plugin.
Class Activate
Class Activate
class ActivateConstants
| Constant | Visibility | Value | Line |
|---|---|---|---|
VERSION_OPTION | private | \'wppo_version\' | 33 |
LEGACY_FLUSH_FLOOR | private | \'1.8.1\' | 45 |
AUTOLOAD_BACKFILL_FLOOR | private | \'2.0.0\' | 59 |
WP_CACHE_FALSE_PATTERN | private | \'/^[ \\t]*define\\(\\s*[\\\'\"]WP_CACHE[\\\'\"]\\s*,\\s*false\\s*\\)\\s*;/mi\' | 71 |
WP_CACHE_TRUE_PATTERN | private | \'/^[ \\t]*define\\(\\s*[\\\'\"]WP_CACHE[\\\'\"]\\s*,\\s*true\\s*\\)/mi\' | 82 |
WP_CACHE_GUARD_BLOCK | private | \"/** Enables WordPress Cache */\\nif ( ! defined( \'WP_CACHE\' ) ) {\\n\\tdefine( \'WP_CACHE\', true );\\n}\\n\" | 90 |
publicstatic init()
public static function init(): voidInitializes the activation process.
Return: void.
privatestatic maybe_seed_settings()
private static function maybe_seed_settings(): voidSeed wppo_settings with defaults on fresh install so CLI works immediately.
Return: void.
publicstatic maybe_run_upgrades()
public static function maybe_run_upgrades(bool=false $is_fresh_install): voidRuns one-time upgrade routines when the plugin version changes. Parameter Type Default Description $is_fresh_installbool=false— True when running from a brand-new activation (no prior install on this site).
Return: void.
privatestatic is_plausible_version()
private static function is_plausible_version(string $stored_version): boolWhether a stored version string is plausible enough to gate on. Parameter Type Default Description $stored_versionstring— Raw stored version value.
Return: bool — True when the value looks like a dotted version number, optionally followed by a single `-`/`+` prerelease/build suffix (dots and hyphens allowed, e.g. `2.0.0-rc-1`).
publicstatic schedule_upgrade_routine()
public static function schedule_upgrade_routine(int=MINUTE_IN_SECONDS $delay): voidSchedules the upgrade routine to run in the background via WP-Cron. Parameter Type Default Description $delayint=MINUTE_IN_SECONDS— Delay in seconds before the event runs.
Return: void.
privatestatic build_wp_cache_contents()
private static function build_wp_cache_contents(string $contents, bool $runtime_defined_false): ?stringBuilds the new wp-config.php contents enabling WP_CACHE. Parameter Type Default Description $contentsstring— Current wp-config.php contents. $runtime_defined_falsebool— Whether WP_CACHE is already defined false at runtime.
Return: string|null — New file contents, or null when no write should happen.
publicstatic add_wp_cache_constant()
public static function add_wp_cache_constant(): ?stringAdds the WP_CACHE guard block to wp-config.php when the constant is not enabled.
Return: string|null — Notice key for the admin layer, or null if nothing to report.
privatestatic create_activity_log_table()
private static function create_activity_log_table(): voidCreates the activity log table in the database if it doesn\’t exist.
Return: void.