all repos — wp-ffpc @ c84498d06997f6f6d87d38182ee1b5f10648576a

1.9.1, see changelog
Peter Molnar hello@petermolnar.eu
Sun, 18 Oct 2015 18:32:10 +0100
commit

c84498d06997f6f6d87d38182ee1b5f10648576a

parent

fedcdfc2783285b6d34cedea36e058e33e6ebd56

M backends/apc.phpbackends/apc.php

@@ -10,13 +10,13 @@ */

protected function _init () { /* verify apc functions exist, apc extension is loaded */ if ( ! function_exists( 'apc_cache_info' ) ) { - $this->log ( __translate__('APC extension missing', $this->plugin_constant ) ); + $this->log ( __translate__('APC extension missing', 'wp-ffpc' ) ); return false; } /* verify apc is working */ if ( apc_cache_info("user",true) ) { - $this->log ( __translate__('backend OK', $this->plugin_constant ) ); + $this->log ( __translate__('backend OK', 'wp-ffpc' ) ); $this->alive = true; } }

@@ -79,11 +79,11 @@ $keys = array ( $keys => true );

foreach ( $keys as $key => $dummy ) { if ( ! apc_delete ( $key ) ) { - $this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', $this->plugin_constant ), $key ), LOG_WARNING ); + $this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', 'wp-ffpc' ), $key ), LOG_WARNING ); //throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key ); } else { - $this->log ( sprintf( __translate__( 'APC entry delete: %s', $this->plugin_constant ), $key ) ); + $this->log ( sprintf( __translate__( 'APC entry delete: %s', 'wp-ffpc' ), $key ) ); } } }
M backends/apcu.phpbackends/apcu.php

@@ -10,13 +10,13 @@ */

protected function _init () { /* verify apcu functions exist, apcu extension is loaded */ if ( ! function_exists( 'apcu_cache_info' ) ) { - $this->log ( __translate__('APCu extension missing', $this->plugin_constant ) ); + $this->log ( __translate__('APCu extension missing', 'wp-ffpc' ) ); return false; } /* verify apcu is working */ if ( @apcu_cache_info("user") != false ) { - $this->log ( __translate__('backend OK', $this->plugin_constant ) ); + $this->log ( __translate__('backend OK', 'wp-ffpc' ) ); $this->alive = true; } }

@@ -79,11 +79,11 @@ $keys = array ( $keys => true );

foreach ( $keys as $key => $dummy ) { if ( ! apcu_delete ( $key ) ) { - $this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', $this->plugin_constant ), $key ), LOG_WARNING ); - //throw new Exception ( __translate__('Deleting APC entry failed with key ', $this->plugin_constant ) . $key ); + $this->log ( sprintf( __translate__( 'Failed to delete APC entry: %s', 'wp-ffpc' ), $key ), LOG_WARNING ); + //throw new Exception ( __translate__('Deleting APC entry failed with key ', 'wp-ffpc' ) . $key ); } else { - $this->log ( sprintf( __translate__( 'APC entry delete: %s', $this->plugin_constant ), $key ) ); + $this->log ( sprintf( __translate__( 'APC entry delete: %s', 'wp-ffpc' ), $key ) ); } } }
M backends/memcache.phpbackends/memcache.php

@@ -9,13 +9,13 @@ */

protected function _init () { /* Memcached class does not exist, Memcache extension is not available */ if (!class_exists('Memcache')) { - $this->log ( __translate__('PHP Memcache extension missing', $this->plugin_constant ), LOG_WARNING ); + $this->log ( __translate__('PHP Memcache extension missing', 'wp-ffpc' ), LOG_WARNING ); return false; } /* check for existing server list, otherwise we cannot add backends */ if ( empty ( $this->options['servers'] ) && ! $this->alive ) { - $this->log ( __translate__("servers list is empty, init failed", $this->plugin_constant ), LOG_WARNING ); + $this->log ( __translate__("servers list is empty, init failed", 'wp-ffpc' ), LOG_WARNING ); return false; }

@@ -25,7 +25,7 @@ $this->connection = new Memcache();

/* check if initialization was success or not */ if ( $this->connection === NULL ) { - $this->log ( __translate__( 'error initializing Memcache PHP extension, exiting', $this->plugin_constant ) ); + $this->log ( __translate__( 'error initializing Memcache PHP extension, exiting', 'wp-ffpc' ) ); return false; }

@@ -37,7 +37,7 @@ $this->status[$server_id] = $this->connection->connect ( 'unix:/' . $server['host'] );

else $this->status[$server_id] = $this->connection->connect ( $server['host'] , $server['port'] ); - $this->log ( sprintf( __translate__( '%s added', $this->plugin_constant ), $server_id ) ); + $this->log ( sprintf( __translate__( '%s added', 'wp-ffpc' ), $server_id ) ); } /* backend is now alive */

@@ -51,7 +51,7 @@ *

*/ protected function _status () { /* server status will be calculated by getting server stats */ - $this->log ( __translate__("checking server statuses", $this->plugin_constant )); + $this->log ( __translate__("checking server statuses", 'wp-ffpc' )); /* get servers statistic from connection */ foreach ( $this->options['servers'] as $server_id => $server ) { if ( $server['port'] === 0 )

@@ -59,9 +59,9 @@ $this->status[$server_id] = $this->connection->getServerStatus( $server['host'], 11211 );

else $this->status[$server_id] = $this->connection->getServerStatus( $server['host'], $server['port'] ); if ( $this->status[$server_id] == 0 ) - $this->log ( sprintf( __translate__( '%s server is down', $this->plugin_constant ), $server_id ) ); + $this->log ( sprintf( __translate__( '%s server is down', 'wp-ffpc' ), $server_id ) ); else - $this->log ( sprintf( __translate__( '%s server is up & running', $this->plugin_constant ), $server_id ) ); + $this->log ( sprintf( __translate__( '%s server is up & running', 'wp-ffpc' ), $server_id ) ); } }

@@ -110,10 +110,10 @@ foreach ( $keys as $key => $dummy ) {

$kresult = $this->connection->delete( $key ); if ( $kresult === false ) { - $this->log ( sprintf( __translate__( 'unable to delete entry: %s', $this->plugin_constant ), $key ) ); + $this->log ( sprintf( __translate__( 'unable to delete entry: %s', 'wp-ffpc' ), $key ) ); } else { - $this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $key ) ); + $this->log ( sprintf( __translate__( 'entry deleted: %s', 'wp-ffpc' ), $key ) ); } } }
M backends/memcached.phpbackends/memcached.php

@@ -7,13 +7,13 @@

protected function _init () { /* Memcached class does not exist, Memcached extension is not available */ if (!class_exists('Memcached')) { - $this->log ( __translate__(' Memcached extension missing, wp-ffpc will not be able to function correctly!', $this->plugin_constant ), LOG_WARNING ); + $this->log ( __translate__(' Memcached extension missing, wp-ffpc will not be able to function correctly!', 'wp-ffpc' ), LOG_WARNING ); return false; } /* check for existing server list, otherwise we cannot add backends */ if ( empty ( $this->options['servers'] ) && ! $this->alive ) { - $this->log ( __translate__("Memcached servers list is empty, init failed", $this->plugin_constant ), LOG_WARNING ); + $this->log ( __translate__("Memcached servers list is empty, init failed", 'wp-ffpc' ), LOG_WARNING ); return false; }

@@ -34,7 +34,7 @@ }

/* check if initialization was success or not */ if ( $this->connection === NULL ) { - $this->log ( __translate__( 'error initializing Memcached PHP extension, exiting', $this->plugin_constant ) ); + $this->log ( __translate__( 'error initializing Memcached PHP extension, exiting', 'wp-ffpc' ) ); return false; }

@@ -59,7 +59,7 @@

/* only add servers that does not exists already in connection pool */ if ( !@array_key_exists($server_id , $servers_alive ) ) { $this->connection->addServer( $server['host'], $server['port'] ); - $this->log ( sprintf( __translate__( '%s added', $this->plugin_constant ), $server_id ) ); + $this->log ( sprintf( __translate__( '%s added', 'wp-ffpc' ), $server_id ) ); } }

@@ -74,7 +74,7 @@ *

*/ protected function _status () { /* server status will be calculated by getting server stats */ - $this->log ( __translate__("checking server statuses", $this->plugin_constant )); + $this->log ( __translate__("checking server statuses", 'wp-ffpc' )); /* get server list from connection */ $servers = $this->connection->getServerList();

@@ -82,8 +82,8 @@ foreach ( $servers as $server ) {

$server_id = $server['host'] . self::port_separator . $server['port']; /* reset server status to offline */ $this->status[$server_id] = 0; - if ($this->connection->set($this->plugin_constant, time())) { - $this->log ( sprintf( __translate__( '%s server is up & running', $this->plugin_constant ), $server_id ) ); + if ($this->connection->set('wp-ffpc', time())) { + $this->log ( sprintf( __translate__( '%s server is up & running', 'wp-ffpc' ), $server_id ) ); $this->status[$server_id] = 1; } }

@@ -113,9 +113,9 @@

/* if storing failed, log the error code */ if ( $result === false ) { $code = $this->connection->getResultCode(); - $this->log ( sprintf( __translate__( 'unable to set entry: %s', $this->plugin_constant ), $key ) ); - $this->log ( sprintf( __translate__( 'Memcached error code: %s', $this->plugin_constant ), $code ) ); - //throw new Exception ( __translate__('Unable to store Memcached entry ', $this->plugin_constant ) . $key . __translate__( ', error code: ', $this->plugin_constant ) . $code ); + $this->log ( sprintf( __translate__( 'unable to set entry: %s', 'wp-ffpc' ), $key ) ); + $this->log ( sprintf( __translate__( 'Memcached error code: %s', 'wp-ffpc' ), $code ) ); + //throw new Exception ( __translate__('Unable to store Memcached entry ', 'wp-ffpc' ) . $key . __translate__( ', error code: ', 'wp-ffpc' ) . $code ); } return $result;

@@ -146,11 +146,11 @@ $kresult = $this->connection->delete( $key );

if ( $kresult === false ) { $code = $this->connection->getResultCode(); - $this->log ( sprintf( __translate__( 'unable to delete entry: %s', $this->plugin_constant ), $key ) ); - $this->log ( sprintf( __translate__( 'Memcached error code: %s', $this->plugin_constant ), $code ) ); + $this->log ( sprintf( __translate__( 'unable to delete entry: %s', 'wp-ffpc' ), $key ) ); + $this->log ( sprintf( __translate__( 'Memcached error code: %s', 'wp-ffpc' ), $code ) ); } else { - $this->log ( sprintf( __translate__( 'entry deleted: %s', $this->plugin_constant ), $key ) ); + $this->log ( sprintf( __translate__( 'entry deleted: %s', 'wp-ffpc' ), $key ) ); } } }
M readme.txtreadme.txt

@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XU3DG7LLA76WC

Tags: cache, page cache, full page cache, nginx, memcached, apc, speed Requires at least: 3.0 Tested up to: 4.3.1 -Stable tag: 1.9.0 +Stable tag: 1.9.1 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html

@@ -127,6 +127,14 @@

* every A. indicates BIG changes. * every .B version indicates new features. * every ..C indicates bugfixes for A.B version. + += 1.9.1 = +*2015-10-18* + +* bugfix for is_writable check failures ( see: https://wordpress.org/support/topic/settings-saved-but-getting-not-saved-error-message) +* bugfix for memcached.protocol notice +* typo fixes +* replace variable with string constant in translatable messages = 1.9.0 = *2015-10-14*
M wp-ffpc-abstract.phpwp-ffpc-abstract.php

@@ -10,6 +10,14 @@ function __translate__ ( $text, $domain ) { return $text; }

} } +if ( !function_exists ('__debug__') ) { + /* __ only availabe if we're running from the inside of wordpress, not in advanced-cache.php phase */ + function __debug__ ( $text ) { + if ( defined('WP_FFPC__DEBUG_MODE') && WP_FFPC__DEBUG_MODE == true) + error_log ( __FILE__ . ': ' . $text ); + } +} + if (!class_exists('WP_FFPC_ABSTRACT')): /**
M wp-ffpc-backend.phpwp-ffpc-backend.php

@@ -22,7 +22,6 @@

const host_separator = ','; const port_separator = ':'; - protected $plugin_constant = 'wp-ffpc'; protected $connection = NULL; protected $alive = false; protected $options = array();

@@ -242,7 +241,7 @@ /* log action */

$this->log ( __translate__('flushing cache', 'wp-ffpc') ); /* proxy to internal function */ - $internal = $this->_flush(); + $result = $this->_flush(); if ( $result === false ) $this->log ( __translate__('failed to flush cache', 'wp-ffpc'), LOG_WARNING );
M wp-ffpc-class.phpwp-ffpc-class.php

@@ -67,6 +67,7 @@ /**

* */ public function plugin_post_construct () { + static::debug ( __CLASS__, 'post_construct' ); $this->plugin_url = plugin_dir_url( __FILE__ ); $this->plugin_dir = plugin_dir_path( __FILE__ );

@@ -78,6 +79,7 @@ /**

* init hook function runs before admin panel hook, themeing and options read */ public function plugin_pre_init() { + static::debug ( __CLASS__, 'pre_init' ); /* advanced cache "worker" file */ $this->acache_worker = $this->plugin_dir . $this->plugin_constant . '-acache.php'; /* WordPress advanced-cache.php file location */

@@ -242,7 +244,7 @@

/* get the current runtime configuration for memcache in PHP because Memcache in binary mode is really problematic */ if ( extension_loaded ( 'memcache' ) ) { $memcache_settings = ini_get_all( 'memcache' ); - if ( !empty ( $memcache_settings ) && $this->options['cache_type'] == 'memcache' ) + if ( !empty ( $memcache_settings ) && $this->options['cache_type'] == 'memcache' && isset($memcache_settings['memcache.protocol']) ) { $memcache_protocol = strtolower($memcache_settings['memcache.protocol']['local_value']); if ( $memcache_protocol == 'binary' ) {

@@ -1000,7 +1002,7 @@ *

*/ private function deploy_advanced_cache( ) { - if ( !is_writable( $this->acache )) { + if (!touch($this->acache)) { error_log('Generating advanced-cache.php failed: '.$this->acache.' is not writable'); return false; }

@@ -1010,6 +1012,7 @@ if ( empty ( $this->global_config ) ) {

error_log('Generating advanced-cache.php failed: Global config is empty'); return false; } + /* add the required includes and generate the needed code */ $string[] = "<?php";
M wp-ffpc.phpwp-ffpc.php

@@ -3,7 +3,7 @@ /*

Plugin Name: WP-FFPC Plugin URI: https://github.com/petermolnar/wp-ffpc Description: WordPress in-memory full page cache plugin -Version: 1.9.0 +Version: 1.9.1 Author: Peter Molnar <hello@petermolnar.eu> Author URI: http://petermolnar.eu/ License: GPLv3