Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
stklcode committed Oct 15, 2024
2 parents bd07792 + 712109c commit 8a9c1fb
Show file tree
Hide file tree
Showing 46 changed files with 2,734 additions and 1,252 deletions.
8 changes: 8 additions & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
/.git
/.github
/.wordpress-org
/bin
/node_modules
/tests
/vendor

# Files
/.distignore
/.editorconfig
/.eslintrc.json
/.gitattributes
/.gitignore
/.phpunit.result.cache
/.sonarcloud.properties
/.stylelintrc.json
/composer.json
/composer.lock
/package.json
/package-lock.json
/phpcs.xml
/phpunit.xml
/phpunit.coverage.xml
/phpunit.report.xml
/README.md
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"extends": "plugin:@wordpress/eslint-plugin/es5",
"env": {
"browser": true
},
"rules": {
"camelcase": 0,
"vars-on-top": 0
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Files
/.distignore export-ignore
/.editorconfig export-ignore
/.eslintrc.json export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.stylelintrc.json export-ignore
Expand Down
53 changes: 47 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,60 @@
name: Coding Standards
on: push
name: Tests
on: [push, pull_request]
jobs:
unit:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php: '5.6'
wordpress: '4.7'
- php: '7.4'
wordpress: '5.9'
- php: '8.0'
wordpress: '6.0'
- php: '8.2'
wordpress: '6.4'
- php: '8.3'
wordpress: 'latest'
- php: '8.3'
wordpress: 'nightly'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{matrix.php}}
tools: composer
- name: Install
run: composer install --no-interaction
- name: Build
run: composer build
- name: Setup DB
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: 'mysql-5.7'
root-password: "root"
- name: Setup WP
run: bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1 "${{ matrix.wordpress }}"
- name: PHP unit tests
run: composer test

quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: composer
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: '14'
node-version: '20'
- name: Code style checks for PHP and CSS
run: |
composer install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wordpress-plugin-asset-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
name: Push to stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: composer
- name: Build
run: composer install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wordpress-plugin-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
php-version: '8.2'
tools: composer
- name: Build
run: composer install
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
.idea/
.phpunit.result.cache
css/*.min.css
js/*.min.js
vendor/
node_modules/
composer.lock
package-lock.json
phpunit.*.xml
tests/coverage/
9 changes: 9 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Path to sources.
sonar.sources=inc,js,css,cachify.php
sonar.exclusions=**/*.min.css,**/*.min.js
#sonar.inclusions=

# Path to tests.
sonar.tests=tests
#sonar.test.exclusions=
#sonar.test.inclusions=
1 change: 0 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@wordpress/stylelint-config",
"rules": {
"declaration-property-unit-whitelist": null,
"selector-id-pattern": null
}
}
40 changes: 38 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
# Changelog
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## 2.4.0

Requires PHP 5.6 and WordPress 4.7 or above

* New: introduce Redis (also KeyDB and Valkey) support using the _phpredis_ module (#253), (#252, props @newtovaux)
* New: add `cachify_modify_output` filter
* New: add `cachify_create_gzip_files` to disable creation of static GZip files (#262, props @angcl)
* New: add hooks `cachify_removed_cache_by_url` and `cachify_flushed_total_cache` for additional actions after clearing (#294, props @ouun)
* Removed: APC support (#304)
* Enhance: adjust styling for setup instructions (#215, props @timse201)
* Enhance: update hooks for Multisite initialization in WordPress 5.1 and above (#246, props @ouun)
* Enhance: rework flush hooks and add some third-party triggers for Autoptimize and WooCommerce (#225, props @timse201)
* Enhance: clean up some internal error suppressions (#256)
* Enhance: inform user on cache clear in admin bar (#257, props @angcl)
* Enhance: do not flush the cache for post revisions (#261, props @angcl)
* Enhance: prevent unnecessary cache clearing in some cases (#223) (#224, props @timse201)
* Enhance: remove empty directories when clearing the HDD cache (#289)
* Enhance: introduce common interface for caching backends (#298, props @lloc)
* Enhance: enhance examples for .htaccess and nginx configuration (#302)
* Enhance: show admin notice instead of silent fallback to DB cache, if selected backend is unavailable (#305)
* Enhance: disable gzip creation of required PHP extension is missing (#308)
* Enhance: various internal code clean ups
* Fix: invalidate cache when permalink changes (#285, #286, props @raffaelj)
* Fix: remove empty directories when pruning the HDD cache (#289)
* Fix: correctly add user-agent to robots.txt (#282) (#283)
* Fix: exclude _sitemap.xml_ from caching (#242) (#254)
* Fix: prevent cache generation of non-GET requests (#200) (#258)
* Fix: prevent cache generation of requests with status different from 200 OK (#266) (#267, props @karlkowald)
* Fix: prevent cache generation of non-HTML responses when using content negotiation (#265) (#273, props @Ancocodet)
* Fix: fix styling for various dark mode plugins (#264) (#278)
* Fix: fix SVG markup for icons in dashboard widget (#269, props @Latz)
* Fix: added missing .gz suffix in htaccess (#287) (#291, props @raffaelj)
* Fix: fix some brand names and unify spelling (#297, props @pedro-mendonca)
* Maintenance: Tested up to WordPress 6.6


## 2.3.2
* Fix: enforce WordPress environment for caching modules (#221, props timse201)
* Fix: Remove unnecessary build artifacts from plugin deployment (#226)
Expand Down Expand Up @@ -54,8 +90,8 @@ All notable changes to this project will be documented in this file. This projec
* Fix for the PHP notice "Call to undefined function is_plugin_active_for_network" on WordPress Multisite

## 2.2.0
* Toolbar: Display of the "Flush the cachify cache" button on the frontend
* Toolbar: Controlling the display of the "Flush the cachify cache" button via hook
* Toolbar: Display of the "Flush the Cachify cache" button on the frontend
* Toolbar: Controlling the display of the "Flush the Cachify cache" button via hook

## 2.1.9
* Vervollständigung des Cachify-Pfades in `robots.txt`: `Disallow: /wp-content/cache/cachify/`
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Cachify #
Smart, efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for storing your blog pages. Make WordPress faster!
Smart, efficient cache solution for WordPress. Use DB, HDD, Redis or Memcached for storing your blog pages. Make WordPress faster!

## Description ##
*Cachify* optimizes your page loads by caching posts, pages and custom post types as static content. You can choose between caching via database, on the web server’s hard drive (HDD), Memcached (only on Nginx) or — thanks to APC (Alternative PHP Cache) — directly in the web server’s system cache. Whenever a page or post is loaded, it can be pulled directly from the cache. The amount of database queries and PHP requests will dramatically decrease towards zero, depending on the caching method you chose.
*Cachify* optimizes your page loads by caching posts, pages and custom post types as static content. You can choose between caching via database, on the web server’s hard drive (HDD), Memcached (only on Nginx) or Redis. Whenever a page or post is loaded, it can be pulled directly from the cache. The amount of database queries and PHP requests will dramatically decrease towards zero, depending on the caching method you chose.

### Features ###
* Works with custom post types.
* Caching methods: DB, HDD, APC and Memcached.
* Caching methods: DB, HDD, Redis and Memcached.
* “Flush Cache” button in the WordPress toolbar.
* Ready for WordPress Multisite.
* Optional compression of HTML markup.
Expand Down Expand Up @@ -39,10 +39,10 @@ Smart, efficient cache solution for WordPress. Use DB, HDD, APC or Memcached for
* If you don’t know how to install a plugin for WordPress, [here’s how](https://wordpress.org/support/article/managing-plugins/#installing-plugins).

### Requirements ###
* PHP 5.2.4 or greater
* WordPress 4.4 or greater
* APC 3.1.4 or greater (optional)
* PHP 5.6 or greater
* WordPress 4.7 or greater
* Memcached in Nginx (optional)
* Redis (optional, via the phpredis module)


## Frequently Asked Questions ##
Expand Down
62 changes: 4 additions & 58 deletions apc/proxy.php
Original file line number Diff line number Diff line change
@@ -1,63 +1,9 @@
<?php
/**
* Proxy for APC based caching.
* APC support was removed in Cachify 2.4.0
*
* @package Cachify
*/

if ( ! empty( $_COOKIE ) ) {
foreach ( $_COOKIE as $k => $v ) {
if ( preg_match( '/^(wp-postpass|wordpress_logged_in|comment_author)_/', $k ) ) {
$_cachify_logged_in = true;
break;
}
}
}

/**
* Determines if SSL is used.
* This file is just here to not break any remaining "auto_prepend_file" configurations.
* Will be removed with the next major update, so adjust your server's configuration, if you happen to read this notice.
*
* @see is_ssl() (wp-includes/load.php).
*
* @return bool True if SSL, otherwise false.
* @package Cachify
*/
function cachify_is_ssl() {
if ( isset( $_SERVER['HTTPS'] ) ) {
$https = filter_input( INPUT_SERVER, 'HTTPS', FILTER_SANITIZE_STRING );
if ( 'on' === strtolower( $https ) || '1' === $https ) {
return true;
}
} elseif ( isset( $_SERVER['SERVER_PORT'] ) && ( '443' === $_SERVER['SERVER_PORT'] ) ) {
return true;
}

return false;
}

if (
empty( $_cachify_logged_in )
&& extension_loaded( 'apc' )
&& ( strpos( filter_input( INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_STRING ), '/wp-admin/' ) === false )
&& ( strpos( filter_input( INPUT_SERVER, 'HTTP_ACCEPT_ENCODING', FILTER_SANITIZE_STRING ), 'gzip' ) !== false )
) {
$cache = apc_fetch(
md5(
( cachify_is_ssl() ? 'https-' : '' ) .
filter_input( INPUT_SERVER, 'HTTP_HOST', FILTER_SANITIZE_STRING ) .
filter_input( INPUT_SERVER, 'REQUEST_URI', FILTER_SANITIZE_URL )
) .
'.cachify'
);
if ( $cache ) {
ini_set( 'zlib.output_compression', 'Off' );

header( 'Vary: Accept-Encoding' );
header( 'X-Powered-By: Cachify' );
header( 'Content-Encoding: gzip' );
header( 'Content-Length: ' . strlen( $cache ) );
header( 'Content-Type: text/html; charset=utf-8' );

echo $cache; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
exit;
}
}
Loading

0 comments on commit 8a9c1fb

Please sign in to comment.