class-activate.php

Activate class for the PerformanceOptimise plugin.

Source includes/Core/class-activate.php3 min readPart of Performance Optimisation

includes/Core/class-activate.php

Activate class for the PerformanceOptimise plugin.

Namespace: PerformanceOptimise\\Inc · Lines: 552

Class Activate

Class Activate

Source: includes/Core/class-activate.php, line 25

class Activate

Tags: @since 1.0.0

Constants

ConstantVisibilityValueLine
VERSION_OPTIONprivate\'wppo_version\'33
LEGACY_FLUSH_FLOORprivate\'1.8.1\'45
AUTOLOAD_BACKFILL_FLOORprivate\'2.0.0\'59
WP_CACHE_FALSE_PATTERNprivate\'/^[ \\t]*define\\(\\s*[\\\'\"]WP_CACHE[\\\'\"]\\s*,\\s*false\\s*\\)\\s*;/mi\'71
WP_CACHE_TRUE_PATTERNprivate\'/^[ \\t]*define\\(\\s*[\\\'\"]WP_CACHE[\\\'\"]\\s*,\\s*true\\s*\\)/mi\'82
WP_CACHE_GUARD_BLOCKprivate\"/** Enables WordPress Cache */\\nif ( ! defined( \'WP_CACHE\' ) ) {\\n\\tdefine( \'WP_CACHE\', true );\\n}\\n\"90

publicstatic init()

public static function init(): void

Initializes the activation process.

Return: void.

Tags: @since 1.0.0

Source: includes/Core/class-activate.php, line 100

privatestatic maybe_seed_settings()

private static function maybe_seed_settings(): void

Seed wppo_settings with defaults on fresh install so CLI works immediately.

Return: void.

Tags: @since 2.0.0

Source: includes/Core/class-activate.php, line 199

publicstatic maybe_run_upgrades()

public static function maybe_run_upgrades(bool=false $is_fresh_install): void

Runs one-time upgrade routines when the plugin version changes.

ParameterTypeDefaultDescription
$is_fresh_installbool=false—True when running from a brand-new activation (no prior install on this site).

Return: void.

Tags: @since 1.8.1

Source: includes/Core/class-activate.php, line 245

privatestatic is_plausible_version()

private static function is_plausible_version(string $stored_version): bool

Whether a stored version string is plausible enough to gate on.

ParameterTypeDefaultDescription
$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`).

Tags: @since 2.3.0

Source: includes/Core/class-activate.php, line 329

publicstatic schedule_upgrade_routine()

public static function schedule_upgrade_routine(int=MINUTE_IN_SECONDS $delay): void

Schedules the upgrade routine to run in the background via WP-Cron.

ParameterTypeDefaultDescription
$delayint=MINUTE_IN_SECONDS—Delay in seconds before the event runs.

Return: void.

Tags: @since 1.8.1

Source: includes/Core/class-activate.php, line 344

privatestatic build_wp_cache_contents()

private static function build_wp_cache_contents(string $contents, bool $runtime_defined_false): ?string

Builds the new wp-config.php contents enabling WP_CACHE.

ParameterTypeDefaultDescription
$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.

Tags: @since 2.2.0

Source: includes/Core/class-activate.php, line 367

publicstatic add_wp_cache_constant()

public static function add_wp_cache_constant(): ?string

Adds 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.

Tags: @since 1.0.0

Source: includes/Core/class-activate.php, line 424

privatestatic create_activity_log_table()

private static function create_activity_log_table(): void

Creates the activity log table in the database if it doesn\’t exist.

Return: void.

Tags: @since 1.0.0

Source: includes/Core/class-activate.php, line 524