Skip to content

Commit

Permalink
Merge branch 'develop' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
stklcode committed Mar 29, 2024
2 parents cf9a843 + 429f4e3 commit c692b7a
Show file tree
Hide file tree
Showing 20 changed files with 483 additions and 159 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ jobs:
wordpress: '5.9'
- php: '8.0'
wordpress: '6.0'
- php: '8.1'
- php: '8.2'
wordpress: '6.4'
- php: '8.3'
wordpress: 'latest'
- php: '8.1'
- php: '8.3'
wordpress: 'nightly'
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP
Expand All @@ -43,16 +45,16 @@ jobs:
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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@v3
uses: actions/setup-node@v4
with:
node-version: '16'
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@v3
- 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@v3
- 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
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. This projec
Requires PHP 5.6 and WordPress 4.7 or above

* Fix: invalidate cache when permalink changes (#285, #286, props raffaelj)
* Fix: remove empty directories when pruning the HDD cache (#289)
* 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)
Expand Down Expand Up @@ -64,8 +65,8 @@ Requires PHP 5.6 and WordPress 4.7 or above
* 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
11 changes: 6 additions & 5 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, APC, 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), Redis 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.

### Features ###
* Works with custom post types.
* Caching methods: DB, HDD, APC and Memcached.
* Caching methods: DB, HDD, APC, 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,11 @@ 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
* PHP 5.6 or greater
* WordPress 4.7 or greater
* APC 3.1.4 or greater (optional)
* Memcached in Nginx (optional)
* Redis (optional, via the phpredis module)


## Frequently Asked Questions ##
Expand Down
12 changes: 6 additions & 6 deletions cachify.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Plugin Name: Cachify
* Description: Easy to use WordPress caching plugin. Serving static blog pages from database, disk, Memcached or APC.
* Description: Easy to use WordPress caching plugin. Serving static blog pages from database, disk, Memcached, Redis or APC.
* Author: pluginkollektiv
* Author URI: https://pluginkollektiv.org
* Plugin URI: https://cachify.pluginkollektiv.org
Expand Down Expand Up @@ -38,7 +38,7 @@

/* Constants */
define( 'CACHIFY_FILE', __FILE__ );
define( 'CACHIFY_DIR', dirname( __FILE__ ) );
define( 'CACHIFY_DIR', __DIR__ );
define( 'CACHIFY_BASE', plugin_basename( __FILE__ ) );
define( 'CACHIFY_CACHE_DIR', WP_CONTENT_DIR . '/cache/cachify' );

Expand Down Expand Up @@ -88,14 +88,14 @@
/**
* Autoload the class.
*
* @param string $class the class name.
* @param string $class_name the class name.
*/
function cachify_autoload( $class ) {
if ( in_array( $class, array( 'Cachify', 'Cachify_APC', 'Cachify_DB', 'Cachify_HDD', 'Cachify_MEMCACHED', 'Cachify_CLI' ), true ) ) {
function cachify_autoload( $class_name ) {
if ( in_array( $class_name, array( 'Cachify', 'Cachify_APC', 'Cachify_DB', 'Cachify_HDD', 'Cachify_MEMCACHED', 'Cachify_REDIS', 'Cachify_CLI' ), true ) ) {
require_once sprintf(
'%s/inc/class-%s.php',
CACHIFY_DIR,
strtolower( str_replace( '_', '-', $class ) )
strtolower( str_replace( '_', '-', $class_name ) )
);
}
}
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@
"forum": "https://wordpress.org/support/plugin/cachify"
},
"require": {
"php": ">=5.2.0",
"composer/installers": "~1.0"
"php": ">=5.6",
"composer/installers": "^v1|^v2"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7",
"dealerdirect/phpcodesniffer-composer-installer": "^v1.0",
"matthiasmullie/minify": "^1.3",
"phpunit/phpunit": "^5|^7|^9",
"squizlabs/php_codesniffer": "^3.7",
"squizlabs/php_codesniffer": "^3.9",
"phpcompatibility/phpcompatibility-wp": "^2.1",
"wp-coding-standards/wpcs": "^2.3",
"yoast/phpunit-polyfills": "^1.0"
"wp-coding-standards/wpcs": "^3.1",
"yoast/phpunit-polyfills": "^2.0"
},
"scripts": {
"post-install-cmd": [
Expand Down
2 changes: 1 addition & 1 deletion inc/cachify.settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
printf(
/* translators: Placeholder is the trash icon itself as dashicon */
esc_html__( 'Flush the cache by clicking the button below or the %1$s icon in the admin bar.', 'cachify' ),
'<span class="dashicons dashicons-trash" aria-hidden="true"></span><span class="screen-reader-text">"' . esc_html__( 'Flush the cachify cache', 'cachify' ) . '"</span>'
'<span class="dashicons dashicons-trash" aria-hidden="true"></span><span class="screen-reader-text">"' . esc_html__( 'Flush the Cachify cache', 'cachify' ) . '"</span>'
);
?>
</p>
Expand Down
2 changes: 1 addition & 1 deletion inc/class-cachify-apc.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static function clear_cache() {
* @since 2.0
*/
public static function print_cache() {
return;
// Not supported.
}

/**
Expand Down
17 changes: 8 additions & 9 deletions inc/class-cachify-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ public static function add_commands() {
'shortdesc' => 'Flush site cache',
'synopsis' => array(
array(
'type' => 'flag',
'name' => 'all-methods',
'description' => 'Flush all caching methods',
'optional' => true,
'type' => 'flag',
'name' => 'all-methods',
'description' => 'Flush all caching methods',
'optional' => true,
),
),
)
Expand All @@ -94,14 +94,13 @@ public static function add_commands() {
'shortdesc' => 'Get the size of the cache in bytes',
'synopsis' => array(
array(
'type' => 'flag',
'name' => 'raw',
'description' => 'Raw size output in bytes',
'optional' => true,
'type' => 'flag',
'name' => 'raw',
'description' => 'Raw size output in bytes',
'optional' => true,
),
),
)
);

}
}
11 changes: 6 additions & 5 deletions inc/class-cachify-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,10 @@ public static function get_stats() {
global $wpdb;

/* Read */

return $wpdb->get_var(
'SELECT SUM( CHAR_LENGTH(option_value) ) FROM `' . $wpdb->options . "` WHERE `option_name` LIKE ('\_transient%.cachify')"
return intval(
$wpdb->get_var(
'SELECT SUM( CHAR_LENGTH(option_value) ) FROM `' . $wpdb->options . "` WHERE `option_name` LIKE ('\_transient%.cachify')"
)
);
}

Expand All @@ -166,7 +167,7 @@ public static function get_stats() {
private static function _cache_signature( $detail, $meta ) {
/* No array? */
if ( ! is_array( $meta ) ) {
return;
return '';
}

if ( $detail ) {
Expand Down Expand Up @@ -218,7 +219,7 @@ private static function _page_queries() {
/**
* Return execution time
*
* @return int Execution time in seconds
* @return string Execution time in seconds
*
* @since 0.1
*/
Expand Down
Loading

0 comments on commit c692b7a

Please sign in to comment.