From 8a620af2c323f3a34d1ace6e5077441d0bf6cfd4 Mon Sep 17 00:00:00 2001 From: agata <automa@insicuri.net> Date: Wed, 22 Jan 2020 16:36:08 +0100 Subject: [PATCH] [auto] plugin: wp-super-cache 1.7.0 --- .../plugins/wp-super-cache/ossdl-cdn.php | 2 + wp-content/plugins/wp-super-cache/readme.txt | 24 ++++++---- .../wp-super-cache/wp-cache-phase2.php | 40 +++++++++-------- .../plugins/wp-super-cache/wp-cache.php | 44 +++++++++---------- 4 files changed, 61 insertions(+), 49 deletions(-) diff --git a/wp-content/plugins/wp-super-cache/ossdl-cdn.php b/wp-content/plugins/wp-super-cache/ossdl-cdn.php index 648bde078..71008e7b4 100644 --- a/wp-content/plugins/wp-super-cache/ossdl-cdn.php +++ b/wp-content/plugins/wp-super-cache/ossdl-cdn.php @@ -202,6 +202,8 @@ function scossdl_off_filter( $content ) { $ossdl_arr_of_cnames = array_merge( array( $ossdl_off_cdn_url ), (array) $ossdl_arr_of_cnames ); } + $ossdl_arr_of_cnames = apply_filters( 'wpsc_cdn_urls', $ossdl_arr_of_cnames ); + $dirs = scossdl_off_additional_directories(); $regex = '`(?<=[(\"\'])' . preg_quote( $ossdl_off_blog_url, '`' ) . '/(?:((?:' . $dirs . ')[^\"\')]+)|([^/\"\']+\.[^/\"\')]+))(?=[\"\')])`'; return preg_replace_callback( $regex, 'scossdl_off_rewriter', $content ); diff --git a/wp-content/plugins/wp-super-cache/readme.txt b/wp-content/plugins/wp-super-cache/readme.txt index 81ddec620..b287fae08 100644 --- a/wp-content/plugins/wp-super-cache/readme.txt +++ b/wp-content/plugins/wp-super-cache/readme.txt @@ -2,7 +2,7 @@ * Contributors: donncha, automattic, kraftbj * Tags: performance, caching, wp-cache, wp-super-cache, cache * Tested up to: 5.2.2 -* Stable tag: 1.6.9 +* Stable tag: 1.7.0 * Requires at least: 3.1 * Requires PHP: 5.2.4 * License: GPLv2 or later @@ -266,6 +266,14 @@ Your theme is probably responsive which means it resizes the page to suit whatev ## Changelog ## +### 1.7.0 ### +* Added "wpsc_cdn_urls" filter to modify the URLs used to rewrite URLs. #697 +* Fixed CDN functionality for logged in users. #698 +* Disable settings that don't work in Expert mode. #699 +* Don't enable mobile support by default, but it can still be enabled manually. #700 +* Change "admin bar" to "Toolbar". Props @garrett-eclipse. #701 +* Show settings enabled by "easy" settings page. #703 + ### 1.6.9 ### * Improve the variables and messaging used by advanced-cache.php code. #687 * Add a warning message to the debug log viewer. #688 @@ -293,7 +301,7 @@ Your theme is probably responsive which means it resizes the page to suit whatev * Check advanced-cache.php was created by the plugin before modifying/deleting it. (#666) * When saving settings, save blank lines. Fixes problems with WP_CACHE and WPCACHEHOME in wp-config.php. Related to #652. (#667) * Update outdated code and use is_multisite() (#600) -* Fix the delete cache button in the admin bar. (#603) +* Fix the delete cache button in the Toolbar. (#603) * Code cleanup in #602 * Use get_post_status instead of post_status (#623) * Fixes button - Update Direct Pages (#622) @@ -316,7 +324,7 @@ Your theme is probably responsive which means it resizes the page to suit whatev * Fixes for WP-CLI (#587) (#592) * Bumped the minimum WordPress version to 3.1 to use functions introduced then. (#591) * Fixes to wpsc_post_transition to avoid a fatal error using get_sample_permalink. (#595) -* Fixed the admin bar "Delete Cache" link. (#589) +* Fixed the Toolbar "Delete Cache" link. (#589) * Fixed the headings used in the settings page. (#597) ### 1.6.3 ### @@ -329,7 +337,7 @@ Your theme is probably responsive which means it resizes the page to suit whatev * Don't clean expired cache files after preload if garbage collection is disabled (#572) * On preload, if deleting a post don't delete the sub directories if it's the homepage. (#573) * Fix generation of semaphores when using WP CLI (#576) -* Fix deleting from the admin bar (#578) +* Fix deleting from the Toolbar (#578) * Avoid a strpos() warning. (#579) * Improve deleting of cache in edit/delete/publish actions (#577) * Fixes to headers code (#496) @@ -403,7 +411,7 @@ Your theme is probably responsive which means it resizes the page to suit whatev * Minor changes to indentaion and spaces to tabs conversion (#371) (#395) * Don't set $wp_super_cache_comments here as it's not saved. (#379) * realpath() only works on directories. The cache_file wasn't set correctly. (#377) -* Fix problem deleting cache from admin bar because of realpath() (#381) +* Fix problem deleting cache from Toolbar because of realpath() (#381) * Use trigger_error() instead of echoing to the screen if a config file isn't writeable. (#394) * Added the "wpsc_enable_wp_config_edit" filter to disable editing the wp-config.php (#392) * Fix some PHP notices when comments are edited/published/maintained. (#386) @@ -546,7 +554,7 @@ Your theme is probably responsive which means it resizes the page to suit whatev ### 1.2 ### * Garbage collection of old cache files is significantly improved. I added a scheduled job that keeps an eye on things and restarts the job if necessary. Also, if you enable caching from the Easy page garbage collection will be enabled too. -* Editors can delete single cached files from the admin bar now. +* Editors can delete single cached files from the Toolbar now. * Fixed the cached page counter on the settings page. * Some sites that updated to 1.0 experienced too much garbage collection. There are still stragglers out there who haven't upgraded but that's fixed now! * Supercached mobile files are now used as there was a tiny little typo that needed fixing. @@ -588,7 +596,7 @@ Your theme is probably responsive which means it resizes the page to suit whatev * Removed AddDefaultCharset .htaccess rule * Fixed problem with blogs in a folder and don't have a trailing slash * New scheduling of garbage collection -* Added a "Delete cache" link to admin bar to delete cache of current page. +* Added a "Delete cache" link to Toolbar to delete cache of current page. * Updated documentation * Sorry Digg, Stephen Fry power now! * Updated translations @@ -736,4 +744,4 @@ Your theme is probably responsive which means it resizes the page to suit whatev ## Upgrade Notice ## -Fix security issue with debug log. +Bugfix release. diff --git a/wp-content/plugins/wp-super-cache/wp-cache-phase2.php b/wp-content/plugins/wp-super-cache/wp-cache-phase2.php index 3aacf331e..bc9c91c65 100644 --- a/wp-content/plugins/wp-super-cache/wp-cache-phase2.php +++ b/wp-content/plugins/wp-super-cache/wp-cache-phase2.php @@ -759,6 +759,7 @@ function wpsc_delete_files( $dir, $delete = true ) { wp_cache_debug( 'wpsc_delete_files: directory is blank' ); return false; } + wp_cache_debug( 'wpsc_delete_files: deleting ' . $dir ); // only do this once, this function will be called many times if ( $protected == '' ) { @@ -778,24 +779,35 @@ function wpsc_delete_files( $dir, $delete = true ) { $dir = trailingslashit( $dir ); if ( ! wpsc_is_in_cache_directory( $dir ) ) { + wp_cache_debug( 'wpsc_delete_files: directory is not in cache directory: ' . $dir ); return false; } - if ( in_array( $dir, $protected ) ) + if ( in_array( $dir, $protected ) ) { + wp_cache_debug( 'wpsc_delete_files: directory is protected ' . $dir ); return false; + } if ( is_dir( $dir ) && $dh = @opendir( $dir ) ) { while ( ( $file = readdir( $dh ) ) !== false ) { + wp_cache_debug( 'wpsc_delete_files: reading files: ' . $file ); if ( $file != '.' && $file != '..' && $file != '.htaccess' && is_file( $dir . $file ) ) - if ( $delete ) + if ( $delete ) { + wp_cache_debug( 'wpsc_delete_files: deleting ' . $dir . $file ); @unlink( $dir . $file ); - else + } else { + wp_cache_debug( 'wpsc_delete_files: rebuild or delete ' . $dir . $file ); @wp_cache_rebuild_or_delete( $dir . $file ); + } } closedir( $dh ); - if ( $delete ) + if ( $delete ) { + wp_cache_debug( 'wpsc_delete_files: remove directory ' . $dir ); @rmdir( $dir ); + } + } else { + wp_cache_debug( 'wpsc_delete_files: could not open directory ' . $dir ); } return true; } @@ -1326,20 +1338,6 @@ function wp_cache_phase2() { header( 'Vary: Accept-Encoding, Cookie' ); } - if ( wpsc_is_caching_user_disabled() ) { - wp_cache_debug( 'wp_cache_phase2: Caching disabled for known user! Exit.' ); - define( 'WPSCSHUTDOWNMESSAGE', __( 'Caching disabled for known user. User logged in or cookie found.', 'wp-super-cache' ) ); - add_action( 'wp_footer', 'wpsc_shutdown_message' ); - return false; - } - - if ( wp_cache_user_agent_is_rejected() ) { - define( 'WPSCSHUTDOWNMESSAGE', __( 'Caching disabled because user agent was rejected.', 'wp-super-cache' ) ); - wp_cache_debug( 'wp_cache_phase2: No caching to do as user agent rejected.' ); - add_action( 'wp_footer', 'wpsc_shutdown_message' ); - return false; - } - ob_start( 'wp_cache_ob_callback' ); wp_cache_debug( 'Created output buffer', 4 ); @@ -1859,6 +1857,12 @@ function wp_cache_ob_callback( $buffer ) { } elseif ( empty( $wp_super_cache_query ) && !empty( $buffer ) && apply_filters( 'wpsc_only_cache_known_pages', 1 ) ) { wp_cache_debug( 'wp_cache_ob_callback: wp_super_cache_query is empty. Not caching unknown page type. Return 0 to the wpsc_only_cache_known_pages filter to cache this page.' ); $cache_this_page = false; + } elseif ( wpsc_is_caching_user_disabled() ) { + wp_cache_debug( 'wp_cache_ob_callback: Caching disabled for known user. User logged in or cookie found.' ); + $cache_this_page = false; + } elseif ( wp_cache_user_agent_is_rejected() ) { + wp_cache_debug( 'wp_cache_ob_callback: Caching disabled because user agent was rejected.' ); + $cache_this_page = false; } if ( isset( $wpsc_save_headers ) && $wpsc_save_headers ) diff --git a/wp-content/plugins/wp-super-cache/wp-cache.php b/wp-content/plugins/wp-super-cache/wp-cache.php index f5ba6ed48..753bea00b 100644 --- a/wp-content/plugins/wp-super-cache/wp-cache.php +++ b/wp-content/plugins/wp-super-cache/wp-cache.php @@ -3,7 +3,7 @@ Plugin Name: WP Super Cache Plugin URI: https://wordpress.org/plugins/wp-super-cache/ Description: Very fast caching plugin for WordPress. -Version: 1.6.9 +Version: 1.7.0 Author: Automattic Author URI: https://automattic.com/ License: GPL2+ @@ -548,7 +548,6 @@ function wp_cache_manager_updates() { if ( isset( $_POST[ 'action' ] ) && $_POST[ 'action' ] == 'easysetup' ) { $_POST[ 'action' ] = 'scupdates'; if( isset( $_POST[ 'wp_cache_easy_on' ] ) && $_POST[ 'wp_cache_easy_on' ] == 1 ) { - $_POST[ 'wp_cache_mobile_enabled' ] = 1; $_POST[ 'wp_cache_enabled' ] = 1; $_POST[ 'super_cache_enabled' ] = 1; $_POST[ 'cache_rebuild_files' ] = 1; @@ -575,7 +574,7 @@ function wp_cache_manager_updates() { wp_clear_scheduled_hook( 'wp_cache_gc' ); wp_clear_scheduled_hook( 'wp_cache_gc_watcher' ); } - $advanced_settings = array( 'wp_super_cache_late_init', 'wp_cache_disable_utf8', 'wp_cache_no_cache_for_get', 'wp_supercache_304', 'wp_cache_mfunc_enabled', 'wp_cache_mobile_enabled', 'wp_cache_front_page_checks', 'wp_supercache_cache_list', 'wp_cache_clear_on_post_edit', 'wp_cache_make_known_anon', 'wp_cache_refresh_single_only', 'cache_compression' ); + $advanced_settings = array( 'wp_super_cache_late_init', 'wp_cache_disable_utf8', 'wp_cache_no_cache_for_get', 'wp_supercache_304', 'wp_cache_mfunc_enabled', 'wp_cache_front_page_checks', 'wp_supercache_cache_list', 'wp_cache_clear_on_post_edit', 'wp_cache_make_known_anon', 'wp_cache_refresh_single_only', 'cache_compression' ); foreach( $advanced_settings as $setting ) { if ( isset( $GLOBALS[ $setting ] ) && $GLOBALS[ $setting ] == 1 ) { $_POST[ $setting ] = 1; @@ -1098,25 +1097,16 @@ table.wpsc-settings-table { <em><?php esc_html_e( 'Compression is disabled by default because some hosts have problems with compressed files. Switching it on and off clears the cache.', 'wp-super-cache' ); ?></em><br /> <?php endif; ?> <?php endif; ?> - <label><input type='checkbox' name='wpsc_save_headers' <?php checked( $wpsc_save_headers ); ?> value='1' /> <?php esc_html_e( 'Cache HTTP headers with page content.', 'wp-super-cache' ); ?></label><br /> <label><input type='checkbox' name='cache_rebuild_files' <?php checked( $cache_rebuild_files ); ?> value='1'> <?php echo esc_html__( 'Cache rebuild. Serve a supercache file to anonymous users while a new file is being generated.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br /> - <?php - $disable_304 = true; - if ( 0 == $wp_cache_mod_rewrite ) - $disable_304 = false; - if ( $disable_304 ) - echo "<strike>"; - ?> - <label><input <?php disabled( $disable_304 ); ?> type='checkbox' name='wp_supercache_304' <?php checked( $wp_supercache_304 ); ?> value='1'> <?php echo esc_html__( '304 Not Modified browser caching. Indicate when a page has not been modified since it was last requested.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br /> - <?php - if ( $disable_304 ) { - echo '</strike>'; - echo '<p><strong>' . esc_html__( 'Warning! 304 browser caching is only supported when mod_rewrite caching is not used.', 'wp-super-cache' ) . '</strong></p>'; - } else { - echo '<em>' . esc_html__( '304 support is disabled by default because some hosts have had problems with the headers used in the past.', 'wp-super-cache' ) . '</em><br />'; - } - ?> - <label><input type='checkbox' name='wp_cache_make_known_anon' <?php checked( $wp_cache_make_known_anon ); ?> value='1'> <?php _e( 'Make known users anonymous so they’re served supercached static files.', 'wp-super-cache' ); ?></label><br /> + <?php if ( $wp_cache_mod_rewrite ) { ?> + <br /> + <p><strong><?php esc_html_e( 'Warning! The following settings are disabled because Expert caching is enabled.', 'wp-super-cache' ); ?></strong></p> + <br /> + <?php } ?> + <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wpsc_save_headers' <?php checked( $wpsc_save_headers ); ?> value='1' /> <?php esc_html_e( 'Cache HTTP headers with page content.', 'wp-super-cache' ); ?></label><br /> + <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_supercache_304' <?php checked( $wp_supercache_304 ); ?> value='1'> <?php echo esc_html__( '304 Browser caching. Improves site performance by checking if the page has changed since the browser last requested it.', 'wp-super-cache' ) . ' <em>(' . esc_html__( 'Recommended', 'wp-super-cache' ) . ')</em>'; ?></label><br /> + <?php echo '<em>' . esc_html__( '304 support is disabled by default because some hosts have had problems with the headers used in the past.', 'wp-super-cache' ) . '</em><br />'; ?> + <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_cache_make_known_anon' <?php checked( $wp_cache_make_known_anon ); ?> value='1'> <?php _e( 'Make known users anonymous so they’re served supercached static files.', 'wp-super-cache' ); ?></label><br /> </legend> </fieldset> </td> @@ -1126,7 +1116,7 @@ table.wpsc-settings-table { <td> <fieldset> <legend class="hidden">Advanced</legend> - <label><input type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1' <?php if ( $wp_cache_mod_rewrite ) { echo "disabled='disabled'"; } ?>> <?php _e( 'Enable dynamic caching. (See <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> or wp-super-cache/plugins/dynamic-cache-test.php for example code.)', 'wp-super-cache' ); ?></label><br /> + <label><input <?php disabled( $wp_cache_mod_rewrite ); ?> type='checkbox' name='wp_cache_mfunc_enabled' <?php if( $wp_cache_mfunc_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Enable dynamic caching. (See <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> or wp-super-cache/plugins/dynamic-cache-test.php for example code.)', 'wp-super-cache' ); ?></label><br /> <label><input type='checkbox' name='wp_cache_mobile_enabled' <?php if( $wp_cache_mobile_enabled ) echo "checked"; ?> value='1'> <?php _e( 'Mobile device support. (External plugin or theme required. See the <a href="https://wordpress.org/plugins/wp-super-cache/faq/">FAQ</a> for further details.)', 'wp-super-cache' ); ?></label><br /> <?php if ( $wp_cache_mobile_enabled ) { echo '<blockquote><h5>' . __( 'Mobile Browsers', 'wp-super-cache' ) . '</h5>' . esc_html( $wp_cache_mobile_browsers ) . "<br /><h5>" . __( 'Mobile Prefixes', 'wp-super-cache' ) . "</h5>" . esc_html( $wp_cache_mobile_prefixes ) . "<br /></blockquote>"; @@ -1225,6 +1215,14 @@ table.wpsc-settings-table { </td> </tr> </table> + <p><?php _e( 'The following recommended settings will be enabled:', 'wp-super-cache' ); ?></p> + <ol> + <li><?php _e( 'Caching disabled for logged in visitors.', 'wp-super-cache' ); ?></li> + <li><?php _e( 'Simple caching.', 'wp-super-cache' ); ?></li> + <li><?php _e( 'Cache Rebuild.', 'wp-super-cache' ); ?></li> + <li><?php _e( 'Interval garbage collection every 10 minutes with a cache lifetime of 30 minutes (if not configured already).', 'wp-super-cache' ); ?></li> + </ol> + <p><?php _e( 'These settings can be modified on the Advanced Settings page.', 'wp-super-cache' ); ?></p> <?php if ( ! $is_nginx && $cache_enabled && ! $wp_cache_mod_rewrite ) { $scrules = trim( implode( "\n", extract_from_markers( trailingslashit( get_home_path() ) . '.htaccess', 'WPSuperCache' ) ) ); @@ -3832,7 +3830,7 @@ function supercache_admin_bar_render() { } /** - * Adds "Delete Cache" button in WP Admin Bar. + * Adds "Delete Cache" button in WP Toolbar. */ function wpsc_admin_bar_render( $wp_admin_bar ) { -- GitLab