Add static brotli compression support.#720
Closed
stathis wants to merge 2027 commits intoAutomattic:trunkfrom
Closed
Add static brotli compression support.#720stathis wants to merge 2027 commits intoAutomattic:trunkfrom
stathis wants to merge 2027 commits intoAutomattic:trunkfrom
Conversation
* Add note about Cloudflare minification on the tester. * Re-org text and add note about development mode. Tips from: https://wordpress.org/support/topic/wp-super-cache-not-working-timestamps-dont-match/
…utomattic#310) * The activation script should create the configuration file/settings The configuration file and settings are setup the first time the plugin is loaded, but they should be set up when the plugin is activated. * Force WPCACHEHOME update if it's not set correctly. Should fix issues with sites that are transferred to new hosts.
Delete the WP_CACHE and WPCACHEHOME setting from global config file when deactivating
…ttic#314) If wp-cache-config.php was left over after a previous activation of the plugin then $cache_path will probably be set so check for that before setting it.
* Add debug log reporting on .htaccess update. * Show errors if needed when updating .htaccess rules Also, improve the display of mod_rewrite rules on settings page.
…mattic#316) Set $wpsc_served_header to true to show a "Served by" header when serving cached pages. It's now off by default. ref: https://wordpress.org/support/topic/feature-request-suppress-wp-super-cache-header/
…c#317) The loop that preloads taxonomies didn't include the code that checks for the stop condition. Added that now. ref: https://wordpress.org/support/topic/i-cant-cancel-cache-preload/
…ts. (Automattic#319) * Replace home_url with siteurl for legacy sites using diff urls In the past putting WordPress into a separate directory required changes to the URLs but now it doesn't so use the siteurl instead of home url. ref: https://wordpress.org/support/topic/cdn-stopped-working-in-v1-5-x/ * Add a note warning the user is the wrong url is used.
…Automattic#318) * Realpath checks go in one place. Fixes trailing slash prob on Windows Calling trailingslashit() after realpath() causes problems for Windows users because it adds a "/" at the end. That makes comparisons impossible as happened in prune_super_cache() at https://wordpress.org/support/topic/cannot-delete-cache-manually-wp-sc-1-5-0/#post-9349616 * Invert this check so it's behaves properly!
* Bump version to 1.5.2 and update changelog * Removed changelog as it's generated from SVN changes. * Change link from changelog to GH commit list.
…d wp-super-cache This fixes Automattic#321 by making sure that unlink is not run on NULL or empty cache directories that appear to be leaking into this from some other source.
Fix a critical bug that deletes wp-admin when deleting the plugin
…utomattic#323) The deactivate function has already deleted the cache directory so there's no need to do the same thing in the uninstall function.
…Automattic#334) If you toggle debug logging on/off it appears that debug comments are enabled but they may not be. ref: https://wordpress.org/support/topic/wp-super-cache-v1-5-0-not-adding-source-footer-comments/
…utomattic#335) If caching is disabled for logged in users we still should show them html comments if enabled. See https://wordpress.org/support/topic/wp-super-cache-v1-5-0-not-adding-source-footer-comments/
Automattic#332) WordPress installs "in their own directory" will sometimes have different siteurl and home url which can cause problems. This setting will allow the site administrator to set it correctly.
…attic#324) * Add checks on directories to make sure they exist or are valid * Add more checks on directory access including logging. Added a small mod to wpsc_get_realpath() to avoid a warning when "/" is passed to the function. https://wordpress.org/support/topic/warning-realpath-open_basedir-restriction-in-effect-file-is-not-within-t/ Other checks include realpath() returning false, and checking if the cache path exists before working on it. * Check if $cache_file is true because realpath() can return false
Automattic#337) If the cache of a feed is older than the most recently updated post then delete the cached feed and force a regeneration. ref: https://wordpress.org/support/topic/rss-feed-not-being-seen-as-updated-by-third-party-readers/
* OSSDL CDN: Only check nonce on relevant page loads In **ossdl-cdn.php** this code is in the global scope: ```php if ( function_exists( 'wp_verify_nonce' ) ) $valid_nonce = isset($_REQUEST['_wpnonce']) ? wp_verify_nonce($_REQUEST['_wpnonce'], 'wp-cache') : false; else $valid_nonce = false; ``` So it runs on every request, and because the file is included when the plugin first loads, it seems to happen before `wp_verify_nonce` is defined, so it probably is always set to `false` under normal circumstances. The `wp_verify_nonce` function is pluggable, though, so if an override for it gets defined elsewhere by a plugin or something, it might actually be defined when the above nonce check happens. This then throws a fatal error because `wp_verify_nonce` uses `wp_get_current_user`, which is _not_ defined this early. This commit addresses the issue by moving the nonce check inside the only function in the file that uses the `$valid_nonce` variable, `scossdl_off_update`. The `scossdl_off_options` lists this variable as a global as well, but it's never used, so the commit also removes that reference. * No need for global $valid_nonce The nonce in scossdl_off_update() is only used in that function, at least on the CDN page so it doesn't need to be global.
* Use realpath to compare paths; fixes Automattic#341 * realpath() on Windows uses Windows paths We have to use realpath() on every path used in a string comparison as realpath() will change a path so it looks like a Windows path on that platform. ie. c:\Windows\....
* Close div; fixes Automattic#339 * Fixed tab indentation of two lines Minor change to indention of line(s) in this patch.
If the debug log isn't created before debugging is enabled the PHP at the top that checks for the username/password won't be added.
…utomattic#336) * Better notifications on preload page and revert sql to fetch posts Fixes Automattic#326 The function wp_count_posts() only fetches posts of type "post" and some users have other types of posts to preload. The preload page notifications weren't clear enough, so this makes them into proper admin notices. * Fix use of wpsc_post_count(). props @stodorovic * Add the "Cancel preload" button to the admin notice too * Make preload posts more flexible with filters. Props @stodorovic I added an extra filter, "wpsc_preload_type_args" on the arguments to send to get_post_types(). * Fix SQL queries, post types return string, and filter. props @stodorovic
…tic#346) * Don't cache unknown page types, fixes problems with sitemaps Fixes 325 Sitemaps are usually generated by a plugin that exits immediately which causes problems for caching as it doesn't know what type of page it is. This code refuses to cache pages if the plugin doesn't know exactly what type of page is being served. A debug log entry is also generated. * Typo fixed in query check. * Improve detection of sitemaps by using query_vars, props @stodorovic Add X-Robots-Tag header used by sitemaps. Fix $headers/$response mixup introduced in 1.5.0 * Use the is_feed from $wp_super_cache_query instead of is_feed(). The variable $wp_super_cache_query[ 'is_feed' ] is set when a sitemap is detected as well as a feed making it more useful.
Some of the settings don't work in expert mode because files are served by mod_rewrite rules so make it clear which ones are affected by disabling them and printing a message. Prompted by: https://wordpress.org/support/topic/304-not-modified-greyed-out/
Mobile support is too complicated in this plugin and is probably not required as themes resize to suit the browser. It can still be enabled from the advanced settings page.
…iage found in core WP. (Automattic#701)
* Update version number and changelog. * Update changelog
To be used in conjunction with https://github.com/kjdev/php-ext-brotli
* Bump the tested version to 5.3.2 * Check if $value is an array to avoid PHP warnings. Props @Chillinchiz ref: https://wordpress.org/support/topic/php-7-4-and-wp-supercache/#post-12335149
* Fix it's -> its * Document the wp-super-cache-plugins directory
* Update origin pull link It was going to a 404, probably because SoftLayer was acquired by IBM and is now called/part of IBM Cloud. * Update ossdl-cdn.php Change origin pull link again, to a Google search. Co-authored-by: Donncha Ó Caoimh <donncha@automattic.com>
My day job, we do a pretty good job od serving polls and surveys!
Bump version number, changelog, updated contributors list.
|
@donnchawp @stathis 's code that adds Brotli support seems straight forward. Brotli does a lot to further reduce bandwidth usage beyond what can be achieved with gzip. Can you please merge this commit? To this day, I have been running a shell script under CentOS 7 Linux to perform brotli compression of static assets, served by nginx-more (a Brotli-enabled Nginx build) with the brotli_static configuration option enabled. It works, but it would be so much more elegant and convenient to have this done by WP Super Cache. |
* is_writeable works fine on non Windows systems. * Check if ! WIN after checking for Darwin. Match a whole lot more Unix systems. * Yoda this.
Some hosts don't want the advanced-cache.php to be overwritten so we should handle that. If another caching plugin was installed make sure that we don't clobber their file. Don't delete the advanced-cache.php if it doesn't belong to this plugin.
* Fix plugin for usage with Debian wordpress package
Debian packages wordpress in a way that a single wordpress instance can
be used to serve multiple websites. The wp-config.php file is stored
in a well-known location: /etc/wordpress/config-$HOST.php as explained
in the [README.Debian] file.
The package defines DEBIAN_FILE as the filename of the configuration
file. When it is defined, and if the wp-config.php was not found using
the "traditional" way, use it.
By default, this file is not writable by the application, adding the
following to it is enough to use the plugin:
define('WP_CACHE', true);
define('WPCACHEHOME', '/var/lib/wordpress/wp-content-xxxxx/plugins/wp-super-cache/');
[README.Debian]:https://salsa.debian.org/debian/wordpress/blob/master/debian/README.debian
* Fix formatting of patch
* Check if this file exists
We're checking other locations, might as well check here too.
Co-authored-by: Donncha Ó Caoimh <donncha@automattic.com>
* Add Jetpack codesniffing ruleset * Add .phpcs.xml.dist
Update changelog and version tested
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To be used in conjunction with https://github.com/kjdev/php-ext-brotli