0){ echo '

You are using an Older version of SpeedyCache Pro. We suggest you upgrade SpeedyCache Pro to be able to use SpeedyCache without any issue.

'; }elseif(version_compare(SPEEDYCACHE_VERSION, SPEEDYCACHE_PRO_VERSION) < 0){ echo '

You are using an Older version of the Free version of SpeedyCache. We suggest you update the free version of SpeedyCache to be able to use SpeedyCache without any issue.

'; } } function speedycache_pro_activate(){ global $speedycache; if(empty($speedycache)){ $speedycache = new \SpeedyCache(); } $speedycache->options = get_option('speedycache_options', []); $speedycache->options['minify_html'] = true; $speedycache->options['minify_js'] = true; $speedycache->options['render_blocking'] = true; update_option('speedycache_options', $speedycache->options); update_option('speedycache_pro_version', SPEEDYCACHE_PRO_VERSION); } //register_deactivation_hook( __FILE__, '\SpeedyCache\Install::deactivate'); // Looks if SpeedyCache just got updated function speedycache_pro_update_check(){ $sql = array(); $current_version = get_option('speedycache_pro_version'); $version = (int) str_replace('.', '', $current_version); // No update required if($current_version == SPEEDYCACHE_PRO_VERSION){ return true; } // If the user was using SpeedyCache Pro before seperation // then we need to clear the cache as we have updated the location of assets of the Pro version. if(empty($current_version)){ $free_version = get_option('speedycache_version'); if(!empty($free_version)){ $desk_cache = glob(WP_CONTENT_DIR . '/cache/speedycache/'. sanitize_text_field($_SERVER['HTTP_HOST']) .'/all/*', GLOB_ONLYDIR); $mobile_cache = glob(WP_CONTENT_DIR . '/cache/speedycache/'. sanitize_text_field($_SERVER['HTTP_HOST']) .'/mobile-cache/*', GLOB_ONLYDIR); $deletable_dir = []; if(!empty($desk_cache)){ $deletable_dir = $desk_cache; } if(!empty($mobile_cache)){ $deletable_dir = array_merge($mobile_cache, $deletable_dir); } if(!empty($deletable_dir)){ global $wp_filesystem; include_once(ABSPATH . 'wp-admin/includes/file.php'); WP_Filesystem(); foreach($deletable_dir as $dir){ if(method_exists($wp_filesystem, 'delete')){ $wp_filesystem->delete($dir, true); } } } } speedycache_pro_activate(); return; } // Save the new Version update_option('speedycache_pro_version', SPEEDYCACHE_PRO_VERSION); } // Load WP CLI command(s) on demand. if(defined('WP_CLI') && !empty(WP_CLI) && defined('SPEEDYCACHE_PRO')){ include_once SPEEDYCACHE_PRO_DIR.'/main/cli.php'; }