Changeset 3490058
- Timestamp:
- 03/24/2026 01:31:29 PM (5 days ago)
- Location:
- speedycache/trunk
- Files:
-
- 7 edited
-
main/admin.php (modified) (3 diffs)
-
main/cache.php (modified) (5 diffs)
-
main/css.php (modified) (3 diffs)
-
main/delete.php (modified) (12 diffs)
-
main/js.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
-
speedycache.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
speedycache/trunk/main/admin.php
r3367258 r3490058 48 48 $url = SPEEDYCACHE_URL.'/assets/images/'. (defined('SITEPAD') ? 'grey-icon.svg' : 'icon.svg'); 49 49 50 $hooknames[] = add_menu_page('SpeedyCache Settings', 'SpeedyCache', $capability, 'speedycache', '\SpeedyCache\Settings::base', $url); 50 if(defined('SITEPAD')){ 51 $hooknames[] = add_submenu_page('smtp-mail.php', 'SpeedyCache Settings', 'Site Cache', $capability, 'speedycache', '\SpeedyCache\Settings::base', $url); 52 }else{ 53 $hooknames[] = add_menu_page('SpeedyCache Settings', 'SpeedyCache', $capability, 'speedycache', '\SpeedyCache\Settings::base', $url); 54 } 51 55 52 56 foreach($hooknames as $hookname){ … … 101 105 $post_id = Util::sanitize_get('post_id'); 102 106 \SpeedyCache\Delete::cache($post_id); 107 108 do_action('speedycache_update_stats', ''); 103 109 104 110 $redirect_to = esc_url_raw(wp_unslash($_REQUEST['referer'])); … … 117 123 $url = esc_url_raw(wp_unslash($_REQUEST['referer'])); 118 124 \SpeedyCache\Delete::url($url); 125 126 do_action('speedycache_update_stats', ''); 119 127 120 128 wp_safe_redirect($url); -
speedycache/trunk/main/cache.php
r3367258 r3490058 73 73 74 74 $cache_path = self::cache_path(); 75 $cache_path = wp_normalize_path($cache_path); 75 76 76 77 if(!file_exists($cache_path)){ … … 86 87 87 88 $cache_path = wp_normalize_path($cache_path); 88 89 file_put_contents($cache_path, self::$content . "\n<!-- ".esc_html($mobile)."Cache by SpeedyCache https://speedycache.com -->"); 89 $comment = 'Cache by SpeedyCache https://speedycache.com at '.time().' -->'; 90 91 file_put_contents($cache_path, self::$content . "\n<!-- ".esc_html($mobile).$comment); 90 92 91 93 if(function_exists('gzencode') && !empty($speedycache->options['gzip'])){ 92 $gzidded_content = gzencode(self::$content . "\n<!-- ".esc_html($mobile). "Cache by SpeedyCache https://speedycache.com -->");94 $gzidded_content = gzencode(self::$content . "\n<!-- ".esc_html($mobile).$comment); 93 95 file_put_contents($cache_path . '.gz', $gzidded_content); 94 96 } 95 97 96 delete_option('speedycache_html_size'); 97 delete_option('speedycache_assets_size'); 98 do_action('speedycache_update_stats', $cache_path); 98 99 } 99 100 … … 178 179 179 180 if(is_admin()) return false; 181 182 // Since: 1.3.8 183 if(defined('DONOTCACHEPAGE') && DONOTCACHEPAGE) return false; 180 184 181 185 // Since: 1.2.8 we will only cache the page if user is not logged-in. … … 184 188 if(!preg_match( '/<\s*\/\s*html\s*>/i', self::$content)) return false; 185 189 186 if(is_singular() && post_password_required()) return false;190 if(is_singular() && self::is_password_protected()) return false; 187 191 188 192 if(function_exists('is_404') && is_404()) return false; … … 497 501 return \has_shortcode($post->post_content, $shortcode); 498 502 } 503 504 /* 505 * Earlier we were using post_password_required which returns false if the user has placed correct password 506 * making the password protected page, visible to all if once correct user opened the page. 507 * 508 * Since 1.3.8 509 * 510 * @return bool 511 */ 512 static function is_password_protected(){ 513 global $post; 514 515 if(empty($post)){ 516 return false; 517 } 518 519 if(!empty($post->post_password)){ 520 return true; 521 } 522 523 return false; 524 } 499 525 } 526 527 -
speedycache/trunk/main/css.php
r3367258 r3490058 74 74 $minified = self::fix_relative_path($minified, $url); 75 75 file_put_contents($minified_path, $minified); 76 77 // Updating the stat data 78 if(defined('SPEEDYCACHE_PRO')){ 79 $speedycache->asset_stats += strlen($minified); 80 } 76 81 } 77 82 … … 92 97 93 98 static function combine(&$content){ 99 global $speedycache; 100 94 101 if(empty($content)){ 95 102 return; … … 166 173 167 174 $combined_path = $asset_path.$file_name; 175 176 // Updating the stats 177 if(!file_exists($combined_path) && defined('SPEEDYCACHE_PRO')){ 178 $speedycache->asset_stats += strlen($combined_css); 179 } 168 180 169 181 file_put_contents($combined_path, $combined_css); 182 170 183 $final_url = Util::path_to_url($combined_path); 171 184 -
speedycache/trunk/main/delete.php
r3329748 r3490058 20 20 self::purge_varnish(); 21 21 \SpeedyCache\CDN::purge(); 22 delete_option('speedycache_html_size');23 delete_option('speedycache_assets_size');24 22 25 23 if(empty($actions)){ … … 82 80 \SpeedyCache\Preload::url($link); 83 81 } 84 85 delete_option('speedycache_html_size');86 delete_option('speedycache_assets_size');87 82 } 88 83 … … 138 133 } 139 134 135 do_action('speedycache_cache_pre_unlink', $cache_path); 136 140 137 unlink($cache_path); 141 138 } … … 158 155 \SpeedyCache\Logs::action(); 159 156 } 157 158 delete_option('speedycache_html_size'); 160 159 } 161 160 … … 174 173 \SpeedyCache\Logs::action(); 175 174 } 175 176 delete_option('speedycache_assets_size'); 176 177 } 177 178 … … 221 222 222 223 foreach($files as $file){ 223 if(is_dir($dir.'/'.$file)){ 224 self::rmdir($dir.'/'.$file); 225 continue; 226 } 227 228 unlink($dir.'/'.$file); 224 $file_path = $dir.'/'.$file; 225 if(is_dir($file_path)){ 226 self::rmdir($file_path); 227 continue; 228 } 229 230 do_action('speedycache_cache_pre_unlink', $file_path); 231 232 unlink($file_path); 229 233 } 230 234 … … 330 334 } 331 335 332 // We will delete it even if the cache does not gets deleted333 delete_option('speedycache_html_size');334 delete_option('speedycache_assets_size');335 336 336 if(class_exists('\SpeedyCache\Logs')){ 337 337 \SpeedyCache\Logs::log('delete'); … … 352 352 return; 353 353 } 354 355 // Need to make sure the folder has been emptied 356 $cache_deleted = false; 354 357 355 358 foreach($files as $file){ … … 365 368 // everything colud be a overhead. 366 369 if((self::$cache_lifespan >= 10 * HOUR_IN_SECONDS) || ((filemtime($file_path) + self::$cache_lifespan) < time())){ 367 unlink($file_path); 368 } 370 do_action('speedycache_cache_pre_unlink', $file_path); 371 372 if(unlink($file_path)){ 373 $cache_deleted = true; 374 } else { 375 $cache_deleted = false; 376 } 377 } 378 } 379 380 // Delete the folder as well, else it will continue to consume inode for cache not even there. 381 if($cache_deleted && file_exists($path) && is_dir($path)){ 382 @rmdir($path); 369 383 } 370 384 } … … 423 437 // This is used to delete post which may have the current post as the related post / product in them 424 438 self::adjacent_posts_urls(); 439 440 do_action('speedycache_update_stats', ''); 425 441 } 426 442 … … 440 456 441 457 self::cache($comment->comment_parent); 458 459 do_action('speedycache_update_stats', ''); 442 460 443 461 } … … 576 594 $shop_page_id = wc_get_page_id('shop'); 577 595 self::cache($shop_page_id); 596 597 do_action('speedycache_update_stats', ''); 578 598 } 579 599 } -
speedycache/trunk/main/js.php
r3140690 r3490058 78 78 79 79 $minified_path = $asset_path.$file_name; 80 81 if(!file_exists($minified_path) && defined('SPEEDYCACHE_PRO')){ 82 $speedycache->asset_stats += strlen($js); // Updating the stats 83 } 80 84 81 85 file_put_contents($minified_path, $js); 86 82 87 83 88 $minified_url = Util::path_to_url($minified_path); … … 123 128 continue; 124 129 } 125 130 126 131 // We wont combine modules. 127 132 if(!empty($tag[1]) && strpos($tag[1], 'module')){ … … 132 137 133 138 if(self::is_excluded($url)) continue; 134 139 135 140 // We wont process any js that is not present on this WordPress install 136 141 if(strpos($url, $site_host) === FALSE){ 137 142 continue; 138 143 } 139 144 140 145 $file_path = Util::url_to_path($url); 141 146 … … 145 150 146 151 $combined_js = file_get_contents($file_path) . "\n" . $combined_js; 147 152 148 153 // Removing the JS which has already been combined, as we will add the combined file at the top after title. 149 154 if(!empty($prev_tag)){ 150 155 $content = str_replace($prev_tag, '', $content); 151 156 } 152 157 153 158 // We remove the previous tag, in current iteration, so at last we have a tag to replace wirh the combined script. 154 159 $prev_tag = $tag[0]; … … 178 183 179 184 $combined_path = $asset_path.$file_name; 185 186 if(!file_exists($combined_path) && defined('SPEEDYCACHE_PRO')){ 187 $speedycache->asset_stats += strlen($combined_js); // Updating the stats 188 } 180 189 181 190 file_put_contents($combined_path, $combined_js); … … 184 193 // Injecting the Combined JS 185 194 if(!empty($prev_tag)){ 186 $content = str_replace($prev_tag, '<script src="'.esc_url($final_url).'" />', $content);187 return; 188 } 189 190 $content = str_replace('</title>', "</title>\n".'<script src="'.esc_url($final_url).'" />', $content);195 $content = str_replace($prev_tag, '<script src="'.esc_url($final_url).'" ></script>', $content); 196 return; 197 } 198 199 $content = str_replace('</title>', "</title>\n".'<script src="'.esc_url($final_url).'"></script>', $content); 191 200 192 201 } -
speedycache/trunk/readme.txt
r3422926 r3490058 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.0 7 Stable tag: 1.3. 77 Stable tag: 1.3.8 8 8 License: GPLv3 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 148 148 == Changelog == 149 149 150 = 1.3.8 (24rd March 2026) = 151 * [Improvement] SpeedyCache now honors DONOTCACHEPAGE constant. 152 * [Bug-Fix Pro] wp_cache_flush_runtime was flushing Redis cache as well, this has been fixed to flush only the PHP object cache. 153 * [Bug-Fix Pro] Images converted to webp using "Modern Image Formats" plugin were shown in the list of images to be optimized in SpeedyCache Image optimization, this has been fixed. 154 * [Bug-Fix Pro] When doing Optimize all in image optimization, for some errors the response was being returned as null this has been fixed. 155 * [Bug-Fix] Cache lifespan was not deleting the directories, this has been fixed. 156 * [Bug-Fix] Password protected pages were getting cached once a correct password was entered, this has been fixed. 157 * [Bug-Fix] Combine JS was adding self closing script tag, this has been fixed. 158 * [Task] Calculation of memory used by File based cache was calculated on every settings page load. This has been changed to caching the file size in options table, for faster retrieval. 159 150 160 = 1.3.7 (18th December 2025) = 151 161 * [Feature Pro] Auto optimization for database added. -
speedycache/trunk/speedycache.php
r3422926 r3490058 4 4 Plugin URI: https://speedycache.com 5 5 Description: SpeedyCache is a plugin that helps you reduce the load time of your website by means of caching, minification, and compression of your website. 6 Version: 1.3. 76 Version: 1.3.8 7 7 Author: Softaculous Team 8 8 Author URI: https://speedycache.com/ … … 52 52 } 53 53 54 define('SPEEDYCACHE_VERSION', '1.3. 7');54 define('SPEEDYCACHE_VERSION', '1.3.8'); 55 55 define('SPEEDYCACHE_DIR', dirname(__FILE__)); 56 56 define('SPEEDYCACHE_FILE', __FILE__); … … 133 133 $speedycache->object = get_option('speedycache_object_cache', ['admin' => true, 'persistent' => true]); 134 134 $speedycache->bloat = get_option('speedycache_bloat', []); 135 $speedycache->asset_stats = 0; 136 $speedycache->html_size = (int) get_option('speedycache_html_size', 0); 135 137 136 138 if(!is_dir(SPEEDYCACHE_CACHE_DIR) && is_writable(WP_CONTENT_DIR)){
Note: See TracChangeset
for help on using the changeset viewer.