diff --git a/.gitchange b/.gitchange index 1dd9d26..a5f0189 100644 --- a/.gitchange +++ b/.gitchange @@ -1,2 +1,2 @@ 1460135613 -d0e05c36184f81b133761b71ca6ee0136be67409:5773b62de5a504.77683431 +d0e05c36184f81b133761b71ca6ee0136be67409:577db4652e9ed8.29921629 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5423ad1..d8c5f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ += v160706 = + +- **New Feature! Apache Optimizations.** This release includes a completely new option panel for Apache Performance Tuning. Current options for Apache tuning include GZIP Compression, Leverage Browser Caching, Enforce Canonical URLs, and Send Access-Control-Allow-Origin Header (for Static CDN Filters). These options automatically add or remove from your `.htaccess` file the appropriate configuration based on the options you enable or disable (all options are disabled by default, so your `.htaccess` file is not modified unless you say so). If you prefer to update your `.htaccess` file manually, the necessary configuration can be viewed beneath each option. Props @jaswsinc, @renzms. See [Issue #789](https://github.com/websharks/comet-cache/issues/789). +- **New Feature!** A new "Enable GZIP Compression" option has been added to the new Apache Optimizations panel. This option will automatically add the appropriate configuration to your `.htaccess` file to enable GZIP compression. This option is disabled by default. The old "GZIP Compression" panel has been removed in favor of the new option inside Apache Optimizations. Props @renzms, @jaswsinc. See [Issue #764](https://github.com/websharks/comet-cache/issues/764). +- **New Feature!** Multisite Host Exclusion Patterns. It's now possible to exclude entire sites from the cache in a Multisite Network environment. Domain mapping is also supported! See _Comet Cache → Plugin Options → Host Exclusion Patterns_. If you're running a Multisite Network with Sub-Directories, you can exclude sites using the existing URI Exclusion Patterns feature. Props @kristineds. See [Issue #754](https://github.com/websharks/comet-cache/issues/754). +- **New Feature (Pro)!** A new "Leverage Browser Caching" option has been added to the new Apache Optimizations panel. This option will automatically add the appropriate configuration to your `.htaccess` file to enable Browser Caching. This option is disabled by default. Props @renzms, @jaswsinc. See [Issue #764](https://github.com/websharks/comet-cache/issues/764). +- **New Feature (Pro)!** A new "Enforce Canonical URLs" option has been added to the new Apache Optimizations panel. This options adds the appropriate `.htaccess` code to enforce the correct canonical URLs according to your WordPress Permalink settings (Comet Cache detects if the Permalink Structure ends with a trailing slash, or without a trailing slash). Props @renzms, @jaswsinc. See [Issue #554](https://github.com/websharks/comet-cache/issues/554). +- **Bug Fix**: In some scenarios the Cron Event that cleans up expired cache files (`_cron_comet_cache_cleanup`) would never run, or the Next Run time would constantly reset to 1 minute away from running every time a page was reloaded. We suspect this is a race condition and in attempt to work around this issue we now skip all of our Cron-related checks if Cron is currently in the middle of running a process. Props @xberg and @lkraav for help reporting. See [Issue #653](https://github.com/websharks/comet-cache/issues/653). +- **Bug Fix**: If your site uses aliased domains, Comet Cache now properly considers all possible domain variations when it clears the cache on WP Standard installations. Props @kristineds, @jaswsinc, @yoffe, and @VR51. See [Issue #608](https://github.com/websharks/comet-cache/issues/608). +- **Bug Fix** (Pro): Fixed a bug where Comet Cache would appear to prevent WordPress from redirecting Permalinks that don't include a trailing slash, to the URL that does include a trailing slash. This was due to the fact that Comet Cache loads very early on (for caching purposes) and as a result the WordPress `redirect_canonical()` function never gets run. This was fixed by adding an option to the new Apache Optimizations panel that allows you to Enforce Canonical URLs. Props @renzms, @jaswsinc. See [Issue #554](https://github.com/websharks/comet-cache/issues/554). +- **UX Bug Fix** (Pro): If you had your WordPress Dashboard login details saved by your browser, the browser autofill would automatically fill in the Pro Plugin Updater fields with those details, which then needed to be replaced with your actual Pro license details. The browser autofill has been disabled for those fields (tested in Chrome, Firefox, and Safari). Props @renzms. See [Issue #741](https://github.com/websharks/comet-cache/issues/741). +- **Enhancement**: Added links the Options Page for the Comet Cache [Twitter](http://twitter.com/cometcache) and [Facebook](http://facebook.com/cometcache) accounts. Props @renzms. [Issue #771](https://github.com/websharks/comet-cache/issues/771). +- **Enhancement:** Added full support for UTF-8 (multibyte strings). This release adds full support for UTF-8 throughout the Comet Cache codebase, greatly enhancing Comet Cache's ability to deal with file paths and URLs that may contain UTF-8 characters. Props @jaswsinc. [Issue #703](https://github.com/websharks/comet-cache/issues/703). +- **UI Enhancements**: Improved the Logged-In Users and the Client-Side Caching options panels to dim additional options when the feature is disabled. Additionally, the "Enable HTML Compression for Logged-In Users?" option has been relocated from the HTML Compressor option panel to the more appropriate Logged-In Users option panel. See [Issue #768](https://github.com/websharks/comet-cache/issues/768). +- **UX Enhancement**: Improved the inline docs for Auto-Clear List of Custom URLs to clarify that full URLs must be provided. Props @renzms. See [Issue #781](https://github.com/websharks/comet-cache/issues/781). +- **Enhancement** (Pro): The Pro Plugin Updater has been improved to allow for better compatibility with hosting platforms that use Apache's ModSecurity. In some cases, site owners were seeing a 404 error when attempting to update the Pro version using the Pro Plugin updater because certain ModSecurity rules were blocking the Pro Updater requests. The Pro Plugin Updater now uses WP Transients to store the necessary metadata, which works around the issue with ModSecurity. Props to @seozones for reporting and @jaswsinc for help fixing this. [Issue #416](https://github.com/websharks/comet-cache/issues/416). +- **Enhancement** (Pro): When Static CDN Filters are enabled, it's now possible to disable the automatic insertion of rules into your `.htaccess` file that are designed to prevent issues with [CORS](https://cometcache.com/kb-article/what-are-cross-origin-request-blocked-errors/). See _Apache Optimizations → Send Access-Control-Allow-Origin Header?_ See [Issue #787](https://github.com/websharks/comet-cache/issues/787). +- **Enhancement** (Pro): The HTML Notes added to the bottom of a cached page now specify if the page was cached as the result of an HTTP Request or if it was cached by the Auto-Cache Engine. Props @kristineds. See [Issue #292](https://github.com/websharks/comet-cache/issues/292). +- **Enhancement** (Pro): The Auto-Cache Engine now supports a fallback to cURL using the WP HTTP API. If your PHP configuration has `allow_fopen_url=0`, the Auto-Cache Engine will use the fallback to download the XML Sitemap and parse it from a temporary file. If you want to force the use of this fallback even when `allow_fopen_url=1`, you can use [a filter](https://github.com/websharks/comet-cache/issues/440#issuecomment-228338371). See [Issue #440](https://github.com/websharks/comet-cache/issues/440). +- **UI Enhancement** (Pro): A second button has been added to the bottom of the Pro Plugin Updater page that allows you to "Save and Update Comet Cache Pro" in one step. Props @renzms. See [Issue #741](https://github.com/websharks/comet-cache/issues/741). +- **UI Enhancement** (Pro): The "Cache Stats" button in Admin Bar is now linked to the Cache Stats page. Instead of hovering over the button and then clicking "More Info" inside the popup panel, you can now just click the "Cache Stats" button to go directly to the Cache Stats page. Props @Presskopp, @renzms. See [Issue #780](https://github.com/websharks/comet-cache/issues/780). +- **Comment Mail Compatibility:** Improved compatibility with the Comment Mail plugin by automatically clearing the cache whenever Comment Mail options are changed. Many of the Comment Mail options affect front-end portions of the site, so it's important that the cache is cleared whenever Comment Mail options change. See [Comment Mail Issue #278](https://github.com/websharks/comment-mail/issues/278#issuecomment-225994050). +- **PHP Compatibility:** Improved compatibility back to PHP 5.2 (the lowest version allowed by WordPress). Comet Cache still requires PHP 5.4+, but if you install Comet Cache on a site running PHP 5.2, it will now fail gracefully with a Dashboard notice indicating PHP 5.4+ is required, instead of producing a fatal error. See [Issue #784](https://github.com/websharks/comet-cache/issues/784). +- **WP-CLI Compatibility**: Fixed a bug with deactivating Comet Cache using WP-CLI. Doing so was producing a "Invalid argument; host token empty!" error message. This has been resolved. Props @MarioKnight @jaswsinc @renzms. See [Issue #728](https://github.com/websharks/comet-cache/issues/728). +- Renamed `COMET_CACHE_ALLOW_BROWSER_CACHE` constant to `COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE`. Backwards compatibility has been maintained. +- Renamed `allow_browser_cache` plugin option to `allow_client_side_cache`. + = v160521 = - **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752). diff --git a/comet-cache.php b/comet-cache.php index 4511e5a..6649488 100644 --- a/comet-cache.php +++ b/comet-cache.php @@ -1,6 +1,6 @@ - - AddOutputFilterByType DEFLATE text/plain text/html - AddOutputFilterByType DEFLATE text/xml application/xml application/xhtml+xml application/xml-dtd - AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml image/svg+xml - AddOutputFilterByType DEFLATE text/css text/javascript application/javascript application/x-javascript - AddOutputFilterByType DEFLATE font/otf font/opentype application/font-otf application/x-font-otf - AddOutputFilterByType DEFLATE font/ttf font/truetype application/font-ttf application/x-font-ttf - - - -If your installation of Apache does not have `mod_deflate` installed. You can also enable GZIP compression using PHP configuration alone. In your `php.ini` file, you can simply add the following line anywhere: `zlib.output_compression = on` - = What happens if a user logs in? Are cache files used then? = By default, Comet Cache does NOT serve cached pages to users who are logged in, or to users who have left comments recently. Comet Cache also excludes administrative pages, login pages, POST/PUT/DELETE/GET(w/ query string) requests and/or CLI processes. That being said, the Pro version of Comet Cache DOES make it possible to cache pages even when users ARE logged-in; adding even more speed! This is particularly helpful on membership sites; e.g. sites that run plugins like s2Member™ for instance. @@ -167,7 +160,7 @@ By default, Comet Cache does NOT serve cached pages to users who are logged in, There is no need to use an `.htaccess` file with this plugin; caching is handled by WordPress®/PHP alone. That being said, if you also want to take advantage of GZIP compression (and we do recommend this), then you WILL need an `.htaccess` file to accomplish that part. This plugin fully supports GZIP compression on its output. However, it does not handle GZIP compression directly. We purposely left GZIP compression out of this plugin, because GZIP compression is something that should really be enabled at the Apache level or inside your `php.ini` file. GZIP compression can be used for things like JavaScript and CSS files as well, so why bother turning it on for only WordPress-generated pages when you can enable GZIP at the server level and cover all the bases! -If you want to enable GZIP, create an `.htaccess` file in your WordPress® installation directory and put the following few lines in it. Alternatively, if you already have an `.htaccess` file, just add these lines to it, and that is all there is to it. GZIP is now enabled! +If you want to enable GZIP and your site is running on the Apache web server, visit **Dashboard -> Comet Cache -> Apache Optimizations -> Enable GZIP Compression?**; or to enable GZIP compression manually create an `.htaccess` file in your WordPress® installation directory (or edit the one that's already there) and put the following few lines in it. That is all there is to it. GZIP is now enabled! @@ -240,7 +233,7 @@ WordPress® Multisite Networking is a special consideration in WordPress®. If C You don't have to use an `.htaccess` file to enjoy the performance enhancements provided by this plugin; caching is handled by WordPress®/PHP alone. That being said, if you want to take advantage of GZIP compression (and we do recommend this), then you WILL need an `.htaccess` file to accomplish that part. This plugin fully supports GZIP compression on its output. However, it does not handle GZIP compression directly. We purposely left GZIP compression out of this plugin, because GZIP compression is something that should really be enabled at the Apache level or inside your `php.ini` file. GZIP compression can be used for things like JavaScript and CSS files as well, so why bother turning it on for only WordPress-generated pages when you can enable GZIP at the server level and cover all the bases! -If you want to enable GZIP, create an `.htaccess` file in your WordPress® installation directory and put the following few lines in it. Alternatively, if you already have an `.htaccess` file, just add these lines to it, and that is all there is to it. GZIP is now enabled! +If you want to enable GZIP and your site is running on the Apache web server, visit **Dashboard -> Comet Cache -> Apache Optimizations -> Enable GZIP Compression?**; or to enable GZIP compression manually create an `.htaccess` file in your WordPress® installation directory (or edit the one that's already there) and put the following few lines in it. That is all there is to it. GZIP is now enabled! @@ -272,15 +265,23 @@ Comet Cache is now completely uninstalled and you can start fresh :-) - The ability to cache logged-in users too! (VERY powerful, particularly for membership sites). - A new improved "Clear Cache" button in the admin bar (along with an option to enable/disable this feature). +- Options for Automatic and Intelligent Cache Clearing of Posts, Pages, Custom Post Types, Categories, Tags, Links, Themes, Users, and more. - The ability to disable Dashboard notifications related to automatic clearing/purging on change detections. - The ability to clear Markdown-related cache files generated by the s2Clean theme for WordPress (if installed). - The ability to run custom PHP code whenever the cache is cleared. +- The ability to Auto-Clear a List of Custom URLs. +- Clear Cache User Permissions to give other users permission to clear the cache by specifying a list of Roles and/or Capabilities. - Cache Statistics to help you gain insight into the status of your site cache. - Import/Export functionality for Comet Cache configuration files. - A Dynamic Version Salt (customize the caching engine). +- Multisite Host Exclusion Patterns to exclude specific child blogs from being cached in a Multisite Network. - HTML Compressor to automatically combine and compresses CSS/JS/HTML code. - Auto-Cache Engine to pre-cache your site at 15-minute intervals. - Static CDN Filters to serve some and/or ALL static files on your site from a CDN of your choosing, including support for Multiple CDN Host Names, Domain Sharding, and WordPress Multisite Networks. +- Domain Sharding / Multiple CDN Hosts to work around concurrency limits and make it possible for browsers to download more resources simultaneously. +- Server Load Monitoring to avoid regenerating the cache while the server is very busy by specifying a maximum server load average. +- Cache Statistics and Charts to analyze statistics about the page cache, HTML Compressor cache, PHP OPCache, and server health. +- Apache Optimizations to enable web server GZIP Compression, Leverage Browser Caching, Enforce Canonical URLs, and more. - An Automatic Updater to update Comet Cache Pro from your WordPress Dashboard. - Rockstar support for all Comet Cache features. @@ -291,7 +292,7 @@ Comet Cache is now completely uninstalled and you can start fresh :-) Comet Cache Pro is a wholly contained plugin that _does not_ require Comet Cache Lite to be installed. To install Comet Cache Pro, 1. Deactivate and delete Comet Cache Lite, if it is currently installed -1. Download Comet Cache Pro from your account at WebSharks-Inc.com +1. Download Comet Cache Pro from your account at CometCache.com 1. From your WordPress Dashboard, go to **Dashboard -> Plugins -> Add New** and then click on the **Upload Plugin** button at the top 1. Select the Comet Cache Pro zip file you downloaded in step 2 and click "Install Now" 1. After the plugin finishes installing, click the "Activate Plugin" link @@ -309,7 +310,7 @@ In addition to the [WordPress Requirements](http://wordpress.org/about/requireme == License == -Copyright: © 2013 [WebSharks, Inc.](http://www.websharks-inc.com/bizdev/) (coded in the USA) +Copyright: © 2016 [WebSharks, Inc.](http://www.websharks-inc.com/bizdev/) (coded in the USA) Released under the terms of the [GNU General Public License](http://www.gnu.org/licenses/gpl-2.0.html). @@ -336,6 +337,33 @@ Requires WordPress v4.2+. == Changelog == += v160706 = + +- **New Feature! Apache Optimizations.** This release includes a completely new option panel for Apache Performance Tuning. Current options for Apache tuning include GZIP Compression, Leverage Browser Caching, Enforce Canonical URLs, and Send Access-Control-Allow-Origin Header (for Static CDN Filters). These options automatically add or remove from your `.htaccess` file the appropriate configuration based on the options you enable or disable (all options are disabled by default, so your `.htaccess` file is not modified unless you say so). If you prefer to update your `.htaccess` file manually, the necessary configuration can be viewed beneath each option. Props @jaswsinc, @renzms. See [Issue #789](https://github.com/websharks/comet-cache/issues/789). +- **New Feature!** A new "Enable GZIP Compression" option has been added to the new Apache Optimizations panel. This option will automatically add the appropriate configuration to your `.htaccess` file to enable GZIP compression. This option is disabled by default. The old "GZIP Compression" panel has been removed in favor of the new option inside Apache Optimizations. Props @renzms, @jaswsinc. See [Issue #764](https://github.com/websharks/comet-cache/issues/764). +- **New Feature!** Multisite Host Exclusion Patterns. It's now possible to exclude entire sites from the cache in a Multisite Network environment. Domain mapping is also supported! See _Comet Cache → Plugin Options → Host Exclusion Patterns_. If you're running a Multisite Network with Sub-Directories, you can exclude sites using the existing URI Exclusion Patterns feature. Props @kristineds. See [Issue #754](https://github.com/websharks/comet-cache/issues/754). +- **New Feature (Pro)!** A new "Leverage Browser Caching" option has been added to the new Apache Optimizations panel. This option will automatically add the appropriate configuration to your `.htaccess` file to enable Browser Caching. This option is disabled by default. Props @renzms, @jaswsinc. See [Issue #764](https://github.com/websharks/comet-cache/issues/764). +- **New Feature (Pro)!** A new "Enforce Canonical URLs" option has been added to the new Apache Optimizations panel. This options adds the appropriate `.htaccess` code to enforce the correct canonical URLs according to your WordPress Permalink settings (Comet Cache detects if the Permalink Structure ends with a trailing slash, or without a trailing slash). Props @renzms, @jaswsinc. See [Issue #554](https://github.com/websharks/comet-cache/issues/554). +- **Bug Fix**: In some scenarios the Cron Event that cleans up expired cache files (`_cron_comet_cache_cleanup`) would never run, or the Next Run time would constantly reset to 1 minute away from running every time a page was reloaded. We suspect this is a race condition and in attempt to work around this issue we now skip all of our Cron-related checks if Cron is currently in the middle of running a process. Props @xberg and @lkraav for help reporting. See [Issue #653](https://github.com/websharks/comet-cache/issues/653). +- **Bug Fix**: If your site uses aliased domains, Comet Cache now properly considers all possible domain variations when it clears the cache on WP Standard installations. Props @kristineds, @jaswsinc, @yoffe, and @VR51. See [Issue #608](https://github.com/websharks/comet-cache/issues/608). +- **Bug Fix** (Pro): Fixed a bug where Comet Cache would appear to prevent WordPress from redirecting Permalinks that don't include a trailing slash, to the URL that does include a trailing slash. This was due to the fact that Comet Cache loads very early on (for caching purposes) and as a result the WordPress `redirect_canonical()` function never gets run. This was fixed by adding an option to the new Apache Optimizations panel that allows you to Enforce Canonical URLs. Props @renzms, @jaswsinc. See [Issue #554](https://github.com/websharks/comet-cache/issues/554). +- **UX Bug Fix** (Pro): If you had your WordPress Dashboard login details saved by your browser, the browser autofill would automatically fill in the Pro Plugin Updater fields with those details, which then needed to be replaced with your actual Pro license details. The browser autofill has been disabled for those fields (tested in Chrome, Firefox, and Safari). Props @renzms. See [Issue #741](https://github.com/websharks/comet-cache/issues/741). +- **Enhancement**: Added links the Options Page for the Comet Cache [Twitter](http://twitter.com/cometcache) and [Facebook](http://facebook.com/cometcache) accounts. Props @renzms. [Issue #771](https://github.com/websharks/comet-cache/issues/771). +- **Enhancement:** Added full support for UTF-8 (multibyte strings). This release adds full support for UTF-8 throughout the Comet Cache codebase, greatly enhancing Comet Cache's ability to deal with file paths and URLs that may contain UTF-8 characters. Props @jaswsinc. [Issue #703](https://github.com/websharks/comet-cache/issues/703). +- **UI Enhancements**: Improved the Logged-In Users and the Client-Side Caching options panels to dim additional options when the feature is disabled. Additionally, the "Enable HTML Compression for Logged-In Users?" option has been relocated from the HTML Compressor option panel to the more appropriate Logged-In Users option panel. See [Issue #768](https://github.com/websharks/comet-cache/issues/768). +- **UX Enhancement**: Improved the inline docs for Auto-Clear List of Custom URLs to clarify that full URLs must be provided. Props @renzms. See [Issue #781](https://github.com/websharks/comet-cache/issues/781). +- **Enhancement** (Pro): The Pro Plugin Updater has been improved to allow for better compatibility with hosting platforms that use Apache's ModSecurity. In some cases, site owners were seeing a 404 error when attempting to update the Pro version using the Pro Plugin updater because certain ModSecurity rules were blocking the Pro Updater requests. The Pro Plugin Updater now uses WP Transients to store the necessary metadata, which works around the issue with ModSecurity. Props to @seozones for reporting and @jaswsinc for help fixing this. [Issue #416](https://github.com/websharks/comet-cache/issues/416). +- **Enhancement** (Pro): When Static CDN Filters are enabled, it's now possible to disable the automatic insertion of rules into your `.htaccess` file that are designed to prevent issues with [CORS](https://cometcache.com/kb-article/what-are-cross-origin-request-blocked-errors/). See _Apache Optimizations → Send Access-Control-Allow-Origin Header?_ See [Issue #787](https://github.com/websharks/comet-cache/issues/787). +- **Enhancement** (Pro): The HTML Notes added to the bottom of a cached page now specify if the page was cached as the result of an HTTP Request or if it was cached by the Auto-Cache Engine. Props @kristineds. See [Issue #292](https://github.com/websharks/comet-cache/issues/292). +- **Enhancement** (Pro): The Auto-Cache Engine now supports a fallback to cURL using the WP HTTP API. If your PHP configuration has `allow_fopen_url=0`, the Auto-Cache Engine will use the fallback to download the XML Sitemap and parse it from a temporary file. If you want to force the use of this fallback even when `allow_fopen_url=1`, you can use [a filter](https://github.com/websharks/comet-cache/issues/440#issuecomment-228338371). See [Issue #440](https://github.com/websharks/comet-cache/issues/440). +- **UI Enhancement** (Pro): A second button has been added to the bottom of the Pro Plugin Updater page that allows you to "Save and Update Comet Cache Pro" in one step. Props @renzms. See [Issue #741](https://github.com/websharks/comet-cache/issues/741). +- **UI Enhancement** (Pro): The "Cache Stats" button in Admin Bar is now linked to the Cache Stats page. Instead of hovering over the button and then clicking "More Info" inside the popup panel, you can now just click the "Cache Stats" button to go directly to the Cache Stats page. Props @Presskopp, @renzms. See [Issue #780](https://github.com/websharks/comet-cache/issues/780). +- **Comment Mail Compatibility:** Improved compatibility with the Comment Mail plugin by automatically clearing the cache whenever Comment Mail options are changed. Many of the Comment Mail options affect front-end portions of the site, so it's important that the cache is cleared whenever Comment Mail options change. See [Comment Mail Issue #278](https://github.com/websharks/comment-mail/issues/278#issuecomment-225994050). +- **PHP Compatibility:** Improved compatibility back to PHP 5.2 (the lowest version allowed by WordPress). Comet Cache still requires PHP 5.4+, but if you install Comet Cache on a site running PHP 5.2, it will now fail gracefully with a Dashboard notice indicating PHP 5.4+ is required, instead of producing a fatal error. See [Issue #784](https://github.com/websharks/comet-cache/issues/784). +- **WP-CLI Compatibility**: Fixed a bug with deactivating Comet Cache using WP-CLI. Doing so was producing a "Invalid argument; host token empty!" error message. This has been resolved. Props @MarioKnight @jaswsinc @renzms. See [Issue #728](https://github.com/websharks/comet-cache/issues/728). +- Renamed `COMET_CACHE_ALLOW_BROWSER_CACHE` constant to `COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE`. Backwards compatibility has been maintained. +- Renamed `allow_browser_cache` plugin option to `allow_client_side_cache`. + = v160521 = - **Bug Fix**: Fixed a bug that, in some scenarios, resulted in "PHP Fatal error: Undefined class constant 'CACHE_PATH_NO_PATH_INDEX'". This also affected the Cache Statistics feature (Comet Cache Pro), resulting in a blank panel when hovering over the Cache Stats button in the menu bar. See [Issue #752](https://github.com/websharks/comet-cache/issues/752). @@ -366,24 +394,4 @@ Requires WordPress v4.2+. - **Compatibility: WP-CLI.** When installing Comet Cache via WP-CLI, Comet Cache is now automatically enabled. There's no need to manually enable Comet Cache from within the plugin options after installing. Props @jaswsinc. See [Issue #464](https://github.com/websharks/comet-cache/issues/464). - **Required WordPress Version is now v4.2.** The minimum required WordPress version has been bumped from v4.1 to v4.2. See [Issue #706](https://github.com/websharks/comet-cache/issues/706). -= v160227 = - -- **Bug Fix**: Fixed a ZenCache Backwards Compatibility bug that was preventing calls to `$GLOBALS['zencache']` from working properly with Comet Cache. See [Issue #689](https://github.com/websharks/comet-cache/issues/689) -- **Bug Fix**: Fixed a ZenCache Backwards Compatibility bug that was preventing `ZENCACHE_ALLOWED` from working properly with Comet Cache. See [Issue #683](https://github.com/websharks/comet-cache/issues/683). -- **Bug Fix**: Fixed a Quick Cache Backwards Compatibility bug that was preventing calls to `$GLOBALS['quick_cache']` from working properly with Comet Cache. Props to @Kedakai for reporting. See [Issue #691](https://github.com/websharks/comet-cache/issues/691). -- **Bug Fix** (Pro): Fixed an Auto-Cache Engine bug that was preventing the Auto-Cache Engine from generating cached pages. Props @digitalhexcode for reporting. See [Issue #679](https://github.com/websharks/comet-cache/issues/679). -- **Enhancement**: Improved the way Comet Cache handles file locking in an effort to improve compatibility with various environments. There were reports of issues with PHP FPM/FastCGI and this release attempts to address those. See [Issue #671](https://github.com/websharks/comet-cache/issues/671) -- **Enhancement** (Pro): A new HTML Compression option allows you to define whether or not HTML Compression should be enabled for Logged-In users (when Logged-In User caching is enabled). See **Comet Cache → Plugin Options → HTML Compression → Enable HTML Compression for Logged-In Users?**. Props @renzms. See [Issue #650](https://github.com/websharks/comet-cache/issues/650). -- **Accelerated Mobile Pages (AMP) Compatibility**: Added full support for Accelerated Mobile Pages via the [AMP plugin](https://wordpress.org/plugins/amp/). Comet Cache now works great alongside the AMP plugin. AMP-generated pages will be cached and those cache files will be intelligently cleared when necessary to keep things up-to-date. See [Issue #688](https://github.com/websharks/comet-cache/issues/688). - -= v160223.1 = - -- **Bug Fix**: Fixes PHP Fatal Error when upgrading from Comet Cache v160211. - -= v160223 = - -- **Announcement: After March 1st, 2016 Comet Cache will require PHP Multibyte String support.** The `mbstring` extension provides Multibyte String support to PHP and is required to properly handle UTF-8 characters, which many sites now use. Without Multibyte String support, caching will be unstable. For that reason we are requiring the `mbstring` extension to improve reliability when caching and to prevent your site from experiencing unforeseen issues in the future.. -- **Bug Fix (Multisite)**: Fixed a bug where when Comet Cache was Network Activated the plugin settings link would show up in the plugins list for the Main Site and would lead to a 404 error. The settings link is now only shown when viewing the plugins list from the Network Admin. Props @jaswsinc. See [Issue #675](https://github.com/websharks/zencache/issues/675). -- **Enhancement**: Added support-related links to the plugin options page. Props @renzms. See [Issue #612](https://github.com/websharks/zencache/issues/612#issuecomment-186827661). - For older changelog history going back to 2009, please see [CHANGELOG.md](https://github.com/websharks/comet-cache/blob/master/CHANGELOG.md). diff --git a/src/client-s/css/admin-bar.min.css b/src/client-s/css/admin-bar.min.css index c65238f..7332066 100644 --- a/src/client-s/css/admin-bar.min.css +++ b/src/client-s/css/admin-bar.min.css @@ -1,2 +1,2 @@  - +/*# sourceMappingURL=admin-bar.min.css.map */ diff --git a/src/includes/classes/AdvCacheBackCompat.php b/src/includes/classes/AdvCacheBackCompat.php index b0440ca..13aab88 100644 --- a/src/includes/classes/AdvCacheBackCompat.php +++ b/src/includes/classes/AdvCacheBackCompat.php @@ -70,7 +70,7 @@ public static function zenCacheConstants() /** * Back compat. with `COMET_CACHE_ALLOW_BROWSER_CACHE` constants. * - * @since 16xxxx Renaming COMET_CACHE_ALLOW_BROWSER_CACHE to COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE + * @since 160706 Renaming COMET_CACHE_ALLOW_BROWSER_CACHE to COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE */ public static function browserCacheConstant() { diff --git a/src/includes/classes/MenuPageOptions.php b/src/includes/classes/MenuPageOptions.php index 7888e1e..513917e 100644 --- a/src/includes/classes/MenuPageOptions.php +++ b/src/includes/classes/MenuPageOptions.php @@ -1060,7 +1060,7 @@ public function __construct() echo '

'.__('Or, you can update your configuration manually: [ .htaccess configuration ]', 'comet-cache').'

'."\n"; echo ' '."\n"; @@ -1081,7 +1081,7 @@ public function __construct() echo '

'.__('Or, you can update your configuration manually: [ .htaccess configuration ]', 'comet-cache').'

'."\n"; echo ' '."\n"; } @@ -1097,9 +1097,9 @@ public function __construct() echo ' '."\n"; } @@ -1118,7 +1118,7 @@ public function __construct() echo '

'.__('Or, you can update your configuration manually: [ .htaccess configuration ]', 'comet-cache').'

'."\n"; echo ' '."\n"; } echo ' '."\n"; diff --git a/src/includes/classes/VsUpgrades.php b/src/includes/classes/VsUpgrades.php index 4276066..f6992a8 100644 --- a/src/includes/classes/VsUpgrades.php +++ b/src/includes/classes/VsUpgrades.php @@ -231,7 +231,7 @@ protected function fromLte160227() * and before we added the `htaccess_access_control_allow_origin` option, * and before we renamed COMET_CACHE_ALLOW_BROWSER_CACHE to COMET_CACHE_ALLOW_CLIENT_SIDE_CACHE. * - * @since 16xxxx + * @since 160706 */ protected function fromLte160521() { diff --git a/src/includes/interfaces/Shared/NcDebugConsts.php b/src/includes/interfaces/Shared/NcDebugConsts.php index 46fffb5..288f3b5 100644 --- a/src/includes/interfaces/Shared/NcDebugConsts.php +++ b/src/includes/interfaces/Shared/NcDebugConsts.php @@ -195,7 +195,7 @@ interface NcDebugConsts /** * No-cache because the current request is excluded by its host name. * - * @since 16xxxx Host exclusions. + * @since 160706 Host exclusions. * * @type string A unique string identifier in the set of `NC_DEBUG_` constants. */ diff --git a/src/includes/stub.php b/src/includes/stub.php index 7b596a2..b12e11a 100644 --- a/src/includes/stub.php +++ b/src/includes/stub.php @@ -13,7 +13,7 @@ require_once dirname(__DIR__).'/vendor/autoload.php'; require_once __DIR__.'/functions/i18n-utils.php'; -${__FILE__}['version'] = '160629-RC'; //version// +${__FILE__}['version'] = '160706'; //version// ${__FILE__}['plugin'] = dirname(dirname(__DIR__)); ${__FILE__}['plugin'] .= '/'.basename(${__FILE__}['plugin']).'.php'; ${__FILE__}['ns_path'] = str_replace('\\', '/', __NAMESPACE__); // To dir/path. diff --git a/src/includes/templates/advanced-cache.txt b/src/includes/templates/advanced-cache.txt index bce27c5..4f0bd13 100644 --- a/src/includes/templates/advanced-cache.txt +++ b/src/includes/templates/advanced-cache.txt @@ -158,7 +158,7 @@ if (!defined('COMET_CACHE_EXCLUDE_HOSTS')) { /** * Host exclusions. * - * @since 16xxxx Adding host exclusions. + * @since 160706 Adding host exclusions. * * @var string A regular expression; else an empty string. */ diff --git a/src/includes/templates/htaccess/canonical-urls-no-ts-enable.txt b/src/includes/templates/htaccess/canonical-urls-no-ts-enable.txt index 5b1bc52..eca3fb2 100644 --- a/src/includes/templates/htaccess/canonical-urls-no-ts-enable.txt +++ b/src/includes/templates/htaccess/canonical-urls-no-ts-enable.txt @@ -1,7 +1,7 @@ # Force NO trailing slash on all virtual requests (except WP admin area). RewriteEngine On - RewriteBase / + RewriteBase %%REWRITE_BASE%% # If not a real file or directory. RewriteCond %{REQUEST_FILENAME} !-f diff --git a/src/includes/templates/htaccess/canonical-urls-ts-enable.txt b/src/includes/templates/htaccess/canonical-urls-ts-enable.txt index 4a0accc..ea0a02b 100644 --- a/src/includes/templates/htaccess/canonical-urls-ts-enable.txt +++ b/src/includes/templates/htaccess/canonical-urls-ts-enable.txt @@ -1,7 +1,7 @@ # Force a trailing slash on all virtual requests (except WP admin area). RewriteEngine On - RewriteBase / + RewriteBase %%REWRITE_BASE%% # If not a real file or directory. RewriteCond %{REQUEST_FILENAME} !-f diff --git a/src/includes/traits/Plugin/HtaccessUtils.php b/src/includes/traits/Plugin/HtaccessUtils.php index 935452b..ce58765 100644 --- a/src/includes/traits/Plugin/HtaccessUtils.php +++ b/src/includes/traits/Plugin/HtaccessUtils.php @@ -83,6 +83,7 @@ public function addWpHtaccess() return true; // Nothing to do, but no failures either. } + $template_blocks = $this->fillReplacementCodes($template_blocks); $template_header = '# BEGIN '.NAME.' '.$this->htaccess_marker.' (the '.$this->htaccess_marker.' marker is required for '.NAME.'; do not remove)'; $template_footer = '# END '.NAME.' '.$this->htaccess_marker; $htaccess['file_contents'] = $template_header."\n\n".trim($template_blocks)."\n\n".$template_footer."\n\n".$htaccess['file_contents']; @@ -199,6 +200,32 @@ public function findHtaccessMarker($htaccess_marker = '') return true; // Htaccess has the marker } + /** + * Utility method used to update replacement codes in .htaccess templates + * + * @since 160706 Adding Apache Optimizations + * + * @param string $template_blocks .htaccess template blocks that may contain replacement codes + * + * @return string Template blocks with replacement codes filled in + */ + public function fillReplacementCodes($template_blocks) + { + if (mb_stripos($template_blocks, '%%') === false) { + return $template_blocks; // No replacement codes to fill + } + + $home_url = is_multisite() ? network_home_url() : home_url(); + $replacement_codes = ['%%REWRITE_BASE%%' => trailingslashit(parse_url($home_url, PHP_URL_PATH))]; + + foreach ($replacement_codes as $_code => $_replacement) { + $template_blocks = preg_replace('/'.preg_quote($_code, '/').'/ui', $_replacement, $template_blocks); + } + unset($_code, $_replacement); + + return $template_blocks; + } + /** * Gets contents of `/.htaccess` file with exclusive lock to read+write. If file doesn't exist, we attempt to create it. * diff --git a/src/includes/traits/Plugin/WcpSettingUtils.php b/src/includes/traits/Plugin/WcpSettingUtils.php index fe222ba..8ad4d02 100644 --- a/src/includes/traits/Plugin/WcpSettingUtils.php +++ b/src/includes/traits/Plugin/WcpSettingUtils.php @@ -25,6 +25,7 @@ public function autoClearCacheOnSettingChanges() $done = true; // Flag as having been done. if ($pagenow === 'options-general.php' && $settings_updated) { + $this->addWpHtaccess(); // Update .htaccess if applicable $counter += $this->autoClearCache(); } elseif ($pagenow === 'options-reading.php' && $settings_updated) { $counter += $this->autoClearCache(); diff --git a/src/includes/traits/Shared/ReplaceUtils.php b/src/includes/traits/Shared/ReplaceUtils.php index c77f37a..bb183a8 100644 --- a/src/includes/traits/Shared/ReplaceUtils.php +++ b/src/includes/traits/Shared/ReplaceUtils.php @@ -8,7 +8,7 @@ trait ReplaceUtils /** * String replace ONE time. * - * @deprecated Deprecated since v16xxxx + * @deprecated Deprecated since v160706 * @deprecated Replaced with Multibyte String support; see https://github.com/websharks/comet-cache/issues/703 * * @since 150422 Rewrite. @@ -37,7 +37,7 @@ public function strReplaceOnce($needle, $replace, $haystack, $caSe_insensitive = /** * String replace ONE time (caSe-insensitive). * - * @deprecated Deprecated since v16xxxx + * @deprecated Deprecated since v160706 * @deprecated Replaced with Multibyte String support; see https://github.com/websharks/comet-cache/issues/703 * * @since 150422 Rewrite.