diff --git a/.wordpress.org/icon-128x128.png b/.wordpress.org/icon-128x128.png
index 3b73b55..97e5e24 100644
Binary files a/.wordpress.org/icon-128x128.png and b/.wordpress.org/icon-128x128.png differ
diff --git a/.wordpress.org/icon-256x256.png b/.wordpress.org/icon-256x256.png
index 5674d2e..f06ab70 100644
Binary files a/.wordpress.org/icon-256x256.png and b/.wordpress.org/icon-256x256.png differ
diff --git a/changelog.txt b/changelog.txt
index 044d1f9..7ffa66b 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,9 @@
+= 20.10.07 (2020-11-26)
+
+- Fixed Tweaks::misc() -> removed deprecated jetpack hook instagram_cache_oembed_api_response_body.
+- Fixed Filesystem::validate_fatal_error_file() -> update timestamp.
+- Added Filesystem::suspend_cache_file().
+
= 20.10.06 (2020-11-23)
- Fixed Filesystem::scanfiles() -> missing regex pattern for dump file.
diff --git a/docket-cache.php b/docket-cache.php
index da78fbc..03eca98 100644
--- a/docket-cache.php
+++ b/docket-cache.php
@@ -12,8 +12,8 @@
* @wordpress-plugin
* Plugin Name: Docket Cache
* Plugin URI: https://wordpress.org/plugins/docket-cache/
- * Version: 20.10.06
- * VerPrev: 20.10.05
+ * Version: 20.10.07
+ * VerPrev: 20.10.06
* Description: A persistent object cache stored as a plain PHP code, accelerates caching with OPcache backend.
* GitHub Plugin URI: https://github.com/nawawi/docket-cache
* Author: Nawawi Jamili
diff --git a/includes/cache.php b/includes/cache.php
index c4cc74c..9921611 100644
--- a/includes/cache.php
+++ b/includes/cache.php
@@ -1227,9 +1227,6 @@ function () use ($req_key) {
*/
private function dc_init()
{
- // handle error
- $this->fs()->capture_fatal_error();
-
if ($this->cf()->is_dcint('MAXSIZE', $dcvalue)) {
if ($dcvalue >= 1000000) {
$this->cache_maxsize = $dcvalue;
diff --git a/includes/object-cache.php b/includes/object-cache.php
index d583873..9b6b02d 100644
--- a/includes/object-cache.php
+++ b/includes/object-cache.php
@@ -3,7 +3,7 @@
* @wordpress-plugin
* Plugin Name: Docket Cache Drop-in
* Plugin URI: https://wordpress.org/plugins/docket-cache/
- * Version: 20.10.06
+ * Version: 20.10.07
* Description: A persistent object cache stored as a plain PHP code, accelerates caching with OPcache backend.
* Author: Nawawi Jamili
* Author URI: https://docketcache.com
diff --git a/includes/src/Crawler.php b/includes/src/Crawler.php
index d61f3da..c279fb9 100644
--- a/includes/src/Crawler.php
+++ b/includes/src/Crawler.php
@@ -14,7 +14,7 @@
final class Crawler
{
- private static $version = '20.10.06';
+ private static $version = '20.10.07';
public static $send_cookie = false;
private static function default_args($param = [])
diff --git a/includes/src/CronAgent.php b/includes/src/CronAgent.php
index 17dc252..ecfa0fd 100644
--- a/includes/src/CronAgent.php
+++ b/includes/src/CronAgent.php
@@ -292,7 +292,7 @@ private function run_wpcron($run_now = false)
try {
do_action_ref_array($hook, $v['args']);
++$run_event;
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$results['wpcron_error'][$hook] = $e->getMessage();
wp_clear_scheduled_hook($hook);
--$run_event;
diff --git a/includes/src/Filesystem.php b/includes/src/Filesystem.php
index 473c090..851e870 100644
--- a/includes/src/Filesystem.php
+++ b/includes/src/Filesystem.php
@@ -135,7 +135,7 @@ public function validate_file($filename, &$error = '')
{
try {
$fileo = new \SplFileObject($filename, 'rb');
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$error = $e->getMessage();
return false;
@@ -167,7 +167,7 @@ public function export_var($data, &$error = '')
{
try {
$data = VarExporter::export($data);
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$error = $e->getMessage();
if (false !== strpos($error, 'Cannot export value of type "stdClass"')) {
$data = var_export($data, 1);
@@ -631,14 +631,26 @@ public function validate_fatal_error_file($file)
return;
}
- $fm = time() - 3600; // 1h
- if ($fm > @filemtime($file_fatal) && $this->validate_file($file)) {
- @unlink($file_fatal);
+ $fm = time() - 300; // 5m
+ if ($fm > @filemtime($file_fatal)) {
+ if ($this->validate_file($file)) {
+ @unlink($file_fatal);
- return;
+ return;
+ }
+
+ // update timestamp
+ @touch($file_fatal);
}
}
+ private function suspend_cache_file($file, $error)
+ {
+ $file_fatal = $this->get_fatal_error_filename($file);
+
+ return @file_put_contents($file_fatal, date('Y-m-d H:i:s T').PHP_EOL.$error, LOCK_EX);
+ }
+
public function capture_fatal_error()
{
register_shutdown_function(
@@ -652,7 +664,7 @@ function () {
$error['file'] = str_replace(ABSPATH, '/', $file_error);
@file_put_contents($file_error, 'export_var($error), LOCK_EX)) {
+ if ($this->suspend_cache_file($file_fatal, $this->export_var($error))) {
if ('cli' !== \PHP_SAPI && !wp_doing_ajax()) {
echo '';
}
@@ -680,6 +692,9 @@ public function cache_get($file)
return false;
}
+ // handle error incase not throwable
+ $this->capture_fatal_error();
+
$data = [];
// include when we can read, try to avoid fatal error.
@@ -687,12 +702,17 @@ public function cache_get($file)
if (flock($handle, LOCK_SH)) {
try {
$data = @include $file;
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$error = $e->getMessage();
+
+ // cleanup
if (false !== strpos($error, 'not found') && @preg_match('@Class.*not found@', $error)) {
$this->unlink($file, false);
}
+ // delay
+ $this->suspend_cache_file($file, $error);
+
$this->log('err', 'internalproc-internalfunc', 'cache_get: '.$error);
$data = false;
}
diff --git a/includes/src/Tweaks.php b/includes/src/Tweaks.php
index 64540e1..dc33918 100644
--- a/includes/src/Tweaks.php
+++ b/includes/src/Tweaks.php
@@ -71,7 +71,8 @@ function () {
// jetpack: enables object caching for the response sent by instagram when querying for instagram image html
// https://developer.jetpack.com/hooks/instagram_cache_oembed_api_response_body/
- add_filter('instagram_cache_oembed_api_response_body', '__return_true');
+ // Removed in Jetpack 9.1.0
+ //add_filter('instagram_cache_oembed_api_response_body', '__return_true');
if (nwdcx_consfalse('TWEAKS_WPCOOKIE_DISABLED')) {
// wp: comment cookie lifetime, default to 30000000 second = 12 months
@@ -117,43 +118,6 @@ function () {
add_filter('the_generator', '__return_empty_string', PHP_INT_MAX);
add_filter('x_redirect_by', '__return_false', PHP_INT_MAX);
-
- // only if has page caching
- /*if (\defined('WP_CACHE') && WP_CACHE) {
- add_action(
- 'after_setup_theme',
- function () {
- nwdcx_consdef('doing_buffer_headerjunk', true);
- @ob_start(null, 700000);
- },
- -PHP_INT_MAX
- );
-
- add_action(
- 'wp_head',
- function () {
- if (nwdcx_construe('doing_buffer_headerjunk')) {
- $content = @ob_get_clean();
- if (empty($content)) {
- return;
- }
-
- if (false !== strpos($content, 'gmpg.org/xfn/11')) {
- $regexp = '@]+href=(?:\'|")(https?:)?\/\/gmpg.org\/xfn\/11(?:\'|")(?:[^>]+)?>@';
- $content = @preg_replace($regexp, '', $content);
- }
-
- if (false !== strpos($content, 'rel="pingback"')) {
- $regexp = '@(|)@';
- $content = @preg_replace($regexp, '', $content);
- }
-
- echo $content;
- }
- },
- PHP_INT_MAX
- );
- }*/
}
public function pingback()
diff --git a/includes/src/View.php b/includes/src/View.php
index 6089d8c..b06cd66 100644
--- a/includes/src/View.php
+++ b/includes/src/View.php
@@ -53,7 +53,7 @@ public function tail($filename, $limit = 100, $do_last = true, &$error = '')
try {
$fileo = new \SplFileObject($filename, 'rb');
- } catch (\Exception $e) {
+ } catch (\Throwable $e) {
$error = $e->getMessage();
return $object;
diff --git a/languages/docket-cache.pot b/languages/docket-cache.pot
index 58d933e..c8d3aa5 100644
--- a/languages/docket-cache.pot
+++ b/languages/docket-cache.pot
@@ -2,14 +2,14 @@
# This file is distributed under the same license as the Docket Cache plugin.
msgid ""
msgstr ""
-"Project-Id-Version: Docket Cache 20.10.06\n"
+"Project-Id-Version: Docket Cache 20.10.07\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/docket-cache\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"POT-Creation-Date: 2020-11-22T23:10:13+00:00\n"
+"POT-Creation-Date: 2020-11-25T21:50:53+00:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.4.0\n"
"X-Domain: docket-cache\n"
diff --git a/readme.txt b/readme.txt
index f298d87..5301ed9 100644
--- a/readme.txt
+++ b/readme.txt
@@ -5,7 +5,7 @@ Donate link: https://www.patreon.com/bePatron?u=41796862
Requires at least: 5.4
Tested up to: 5.5
Requires PHP: 7.2.5
-Stable tag: 20.10.06
+Stable tag: 20.10.07
License: MIT
License URI: ./license.txt
@@ -73,11 +73,11 @@ Sponsored by:
Affiliates with:
-- [Dreamhost](https://docketcache.com/wp-content/spx/dreamhost/?utm_source=dcwporg)
-- [Bluehost](https://docketcache.com/wp-content/spx/bluehost/?utm_source=dcwporg)
-- [Exabytes](https://docketcache.com/wp-content/spx/exabytes/?utm_source=dcwporg)
-- [ServerFreak](https://docketcache.com/wp-content/spx/serverfreak/?utm_source=dcwporg)
-- [Digitalocean](https://docketcache.com/wp-content/spx/digitalocean/?utm_source=dcwporg)
+- [Dreamhost](https://mbsy.co/3cGLwM)
+- [Bluehost](https://www.bluehost.com/track/docketcache/)
+- [Exabytes](https://billing.exabytes.my/mypanel/aff.php?aff=8102792)
+- [ServerFreak](https://secure.web-hosting.net.my/clients/aff.php?aff=4725)
+- [Digitalocean](https://m.do.co/c/6c93db5b1ef6)
- [KiahStore](https://docketcache.com/wp-content/spx/kiahstore/?utm_source=dcwporg)
== Development ==
@@ -176,6 +176,12 @@ Yes, you can. It can boost more your WordPress performance since there is no net
Kindly do manually remove wp-content/object-cache.php and wp-content/cache/docket-cache if an error occurs during updates. Thanks.
== Changelog ==
+= 20.10.07 =
+
+- Fixed Tweaks::misc() -> removed deprecated jetpack hook instagram_cache_oembed_api_response_body.
+- Fixed Filesystem::validate_fatal_error_file() -> update timestamp.
+- Added Filesystem::suspend_cache_file().
+
= 20.10.06 =
- Fixed Filesystem::scanfiles() -> missing regex pattern for dump file.
@@ -185,49 +191,6 @@ Kindly do manually remove wp-content/object-cache.php and wp-content/cache/docke
- Added Garbage Collector -> action button output results.
- Added Filesystem::capture_fatal_error() -> attempt to fix any cache file error-prone.
-= 20.10.05 =
-
-- Fixed Litespeed Cache admin notice "Purged all caches successfully" still shown after dismiss.
-
-= 20.10.04 =
-
-- Improved CronAgent.
-- Improved CLI.
-- Improved disk I/O and CPU usage.
-- Optimized WP Alloptions.
-
-Thank you for using docket cache.
-
-= 20.10.03 =
-
-- Fixed nwdcx_optget() -> missing sql syntax.
-
-Thanks to Mark Barnes (@mark8barnes) for reporting this issue.
-
-= 20.10.02 =
-
-- Fixed output buffering issue with page caching.
-
-= 20.10.01 =
-
-This is Major Release based on previous releases.
-
-- Improved precaching.
-- Improved cache stats.
-- Improved garbage collector.
-- Improved disk I/O and CPU usage.
-- Added new constant DOCKET_CACHE_CONTENT_PATH.
-
-Thank you for using docket cache.
-
-= 20.09.07 =
-
-Fix release.
-
-- Fixed Deactivate WooCommerce Widget, prevent error notice _doing_it_wrong for the_widget.
-- Fixed Precaching, always strip query string doing_wp_cron.
-- Fixed nwdcx_network_multi function, replace with simple query to detect multinetwork condition.
-
Kindly refer to [changelog.txt](https://raw.githubusercontent.com/nawawi/docket-cache/master/changelog.txt) for previous changes.