*/ public const ONE_SHOT_MARKERS = array( 'f12_doi_pro_migration_complete', 'f12_doi_pro_migration_autoinstall_pending', 'f12_doi_addon_installer_state', 'f12_doi_addon_auto_install_done', ); /** * Cached validation state. Harmless to drop — it is re-fetched. * * @var array */ public const STALE_TRANSIENTS = array( 'f12_doi_bundle_license_validation', 'f12_doi_bundle_site_registered', 'f12_doi_pro_migration_notice_pending', ); /** * Every legacy monolith found on disk. * * @return array> */ public static function legacyInstallations(): array { return LegacyMonolithDetector::scan(); } /** * The subset of those that WordPress is actually loading. * * @return array> */ public static function activeLegacyInstallations(): array { $active = array(); foreach ( self::legacyInstallations() as $entry ) { if ( self::isPluginActive( $entry['file'] ) ) { $active[] = $entry; } } return $active; } /** * Is bundle-pro 4.x currently active? */ public static function isSuccessorActive(): bool { return self::isPluginActive( self::SUCCESSOR_FILE ); } /** * @param string $file `folder/main-file.php`, as WordPress stores it. */ public static function isPluginActive( string $file ): bool { $active = get_option( 'active_plugins', array() ); if ( is_array( $active ) && in_array( $file, $active, true ) ) { return true; } if ( ! function_exists( 'get_site_option' ) ) { return false; } $network = get_site_option( 'active_sitewide_plugins', array() ); return is_array( $network ) && isset( $network[ $file ] ); } /** * Which one-shot markers are currently set. * * @return array */ public static function burnedMarkers(): array { $found = array(); foreach ( self::ONE_SHOT_MARKERS as $marker ) { if ( get_option( $marker, null ) !== null ) { $found[] = $marker; } } return $found; } }