to_array(), false ); } if ( false === get_option( 'spinix_settings', false ) ) { add_option( 'spinix_settings', Spinix_Scheduler::defaults(), '', 'no' ); } } /** * Deactivation. */ public static function deactivate() { wp_clear_scheduled_hook( Spinix_Scheduler::HOOK ); wp_clear_scheduled_hook( Spinix_Scheduler::CONTINUE_HOOK ); } /** * First normal page load after a restore: rebuild permalinks and purge caches * with every plugin active (so custom post type URLs work immediately). */ public function post_restore() { if ( defined( 'SPINIX_RESTORE_GUARD' ) || ( function_exists( 'wp_installing' ) && wp_installing() ) ) { return; } $flag = get_option( 'spinix_post_restore' ); if ( ! $flag ) { return; } delete_option( 'spinix_post_restore' ); if ( ! function_exists( 'save_mod_rewrite_rules' ) ) { require_once ABSPATH . 'wp-admin/includes/misc.php'; } if ( ! function_exists( 'get_home_path' ) ) { require_once ABSPATH . 'wp-admin/includes/file.php'; } flush_rewrite_rules( true ); self::purge_caches(); Spinix_Log::add( 'Post-restore: permalinks rebuilt and caches purged' ); do_action( 'spinix_after_restore', $flag ); } /** * Purge popular cache plugins and the object cache. */ public static function purge_caches() { if ( function_exists( 'wp_cache_flush' ) ) { wp_cache_flush(); } if ( function_exists( 'rocket_clean_domain' ) ) { rocket_clean_domain(); } if ( function_exists( 'w3tc_flush_all' ) ) { w3tc_flush_all(); } if ( function_exists( 'wp_cache_clear_cache' ) ) { wp_cache_clear_cache(); } if ( class_exists( 'autoptimizeCache' ) && method_exists( 'autoptimizeCache', 'clearall' ) ) { autoptimizeCache::clearall(); } if ( function_exists( 'sg_cachepress_purge_cache' ) ) { sg_cachepress_purge_cache(); } // Third-party cache plugins' own public purge hooks (not hooks of this plugin). do_action( 'litespeed_purge_all' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- LiteSpeed Cache purge hook. do_action( 'wpfc_clear_all_cache' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- WP Fastest Cache purge hook. do_action( 'breeze_clear_all_cache' ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Breeze purge hook. if ( class_exists( '\Elementor\Plugin' ) && isset( \Elementor\Plugin::$instance->files_manager ) ) { \Elementor\Plugin::$instance->files_manager->clear_cache(); } } }