Skip to content

Commit

Permalink
bump 20.11.05
Browse files Browse the repository at this point in the history
- Fixed CronAgent::check_connection() -> close_ping() -> Invalid selfcheck delay. Set to 90 minutes instead of current time.
- Fixed Auto-updates -> wp >= 5.5 can't enable/disable auto-updates for docket cache at plugins page. Now, it should works vise-versa.
- Fixed ReqAction -> Error notice undefined variable nv.
  • Loading branch information
nawawi committed Dec 22, 2020
1 parent 8dc37a3 commit 184176e
Show file tree
Hide file tree
Showing 10 changed files with 120 additions and 48 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ![Docket Cache](./.wordpress.org/icon-128x128.png) Docket Cache
[![WP compatibility](https://plugintests.com/plugins/wporg/docket-cache/wp-badge.svg)](https://plugintests.com/plugins/wporg/docket-cache/latest) [![PHP compatibility](https://plugintests.com/plugins/wporg/docket-cache/php-badge.svg)](https://plugintests.com/plugins/wporg/docket-cache/latest)

A persistent object cache stored as a plain PHP code, accelerates caching with OPcache backend.
Supercharge your website using a persistent object cache, accelerates caching with OPcache backend.

## Description

Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
= v20.11.05 (2020-12-23)

- Fixed CronAgent::check_connection() -> close_ping() -> Invalid selfcheck delay. Set to 90 minutes instead of current time.
- Fixed Auto-updates -> wp >= 5.5 can't enable/disable auto-updates for docket cache at plugins page. Now, it should works vise-versa.
- Fixed ReqAction -> Error notice undefined variable nv.

= v20.11.04 (2020-12-21)

- Fixed Admin Interface -> filter others admin notice using hook.
Expand Down
4 changes: 2 additions & 2 deletions docket-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
* @wordpress-plugin
* Plugin Name: Docket Cache
* Plugin URI: https://wordpress.org/plugins/docket-cache/
* Version: 20.11.04
* VerPrev: 20.11.03
* Version: 20.11.05
* VerPrev: 20.11.04
* 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
Expand Down
2 changes: 1 addition & 1 deletion includes/object-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @wordpress-plugin
* Plugin Name: Docket Cache Drop-in
* Plugin URI: https://wordpress.org/plugins/docket-cache/
* Version: 20.11.04
* Version: 20.11.05
* Description: A persistent object cache stored as a plain PHP code, accelerates caching with OPcache backend.
* Author: Nawawi Jamili
* Author URI: https://docketcache.com
Expand Down
2 changes: 1 addition & 1 deletion includes/src/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

final class Crawler
{
private static $version = '20.11.04';
private static $version = '20.11.05';
public static $send_cookie = false;

private static function default_args($param = [])
Expand Down
2 changes: 1 addition & 1 deletion includes/src/CronAgent.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function ($arr) {
ARRAY_FILTER_USE_KEY
);

$output['selfcheck'] = time();
$output['selfcheck'] = time() + 5400; // 90min
$this->pt->co()->save_part($output, 'pings');

$this->pt->json_header();
Expand Down
106 changes: 81 additions & 25 deletions includes/src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,10 @@ public function activate()

$this->unregister_cronjob();
$this->wearechampion();

if ($this->cf()->is_dctrue('AUTOUPDATE', true)) {
$this->plugin_autoupdates(true);
}
}

/**
Expand Down Expand Up @@ -823,6 +827,23 @@ private function register_init()
$this->notice = '';
}

/**
* critical_version.
*/
private function critical_version()
{
$checkdata = $this->co()->get_part('checkversion', true);
if (!empty($checkdata) && \is_array($checkdata) && !empty($checkdata['doversion'])) {
$current_version = $this->plugin_meta($this->file)['Version'];
if (0 === strcmp($checkdata['doversion'], $current_version)) {
$this->flush_cache(true);
}
}
unset($checkdata);

return true;
}

/**
* plugin_upgrade.
*/
Expand All @@ -846,19 +867,27 @@ function () {
}

/**
* critical_version.
* plugin_autoupdates.
*/
private function critical_version()
private function plugin_autoupdates($enable = true)
{
$checkdata = $this->co()->get_part('checkversion', true);
if (!empty($checkdata) && \is_array($checkdata) && !empty($checkdata['doversion'])) {
$current_version = $this->plugin_meta($this->file)['Version'];
if (0 === strcmp($checkdata['doversion'], $current_version)) {
$this->flush_cache(true);
$options = (array) get_site_option('auto_update_plugins', []);
if ($enable) {
$options[] = $this->hook;
$options = array_unique($options);
} else {
$opt = [];
foreach ($options as $name) {
if ($this->hook === $name) {
continue;
}
$opt[] = $name;
}
$options = $opt;
unset($opt);
}

return true;
update_site_option('auto_update_plugins', $options);
unset($options);
}

/**
Expand Down Expand Up @@ -973,33 +1002,56 @@ function () {

if (!$done) {
$done = true;

$suppress = $wpdb->suppress_errors(true);

$ok = $wpdb->get_var('SELECT @@SESSION.SQL_BIG_SELECTS LIMIT 1');
if (empty($ok)) {
$wpdb->query('SET SESSION SQL_BIG_SELECTS=1');
}

$wpdb->suppress_errors($suppress);
}
}
},
-PHP_INT_MAX
);

if ($this->cf()->is_dctrue('AUTOUPDATE')) {
add_filter(
'auto_update_plugin',
function ($update, $item) {
if ('docket-cache' === $item->slug) {
return true;
if (version_compare($GLOBALS['wp_version'], '5.5', '<')) {
if ($this->cf()->is_dctrue('AUTOUPDATE')) {
add_filter(
'auto_update_plugin',
function ($update, $item) {
if ('docket-cache' === $item->slug) {
return true;
}

return $update;
},
PHP_INT_MAX,
2
);
}
} else {
add_action(
'shutdown',
function () {
if (!wp_doing_ajax()) {
return;
}

return $update;
},
PHP_INT_MAX,
2
if (!current_user_can(is_multisite() ? 'manage_network_options' : 'manage_options')) {
return;
}

if ((!empty($_POST['action']) && 'toggle-auto-updates' === $_POST['action']) && (!empty($_POST['asset']) && $this->hook === $_POST['asset'])) {
$state = sanitize_text_field($_POST['state']);
switch ($state) {
case 'enable':
case 'disable':
$this->co()->save('autoupdate', $state);
break;
}
unset($options);
}
}
);
}

Expand Down Expand Up @@ -1247,11 +1299,11 @@ function () {
if ($this->cx()->validate()) {
if ($this->cx()->is_outdated() && !$this->cx()->install(true)) {
/* translators: %s: url */
$message = sprintf(__('The object-cache.php Drop-In is outdated. Please click <strong>Re-Install</strong> to update it now. <br><br><a href="%s" class="button button-primary">Re-Install</a>', 'docket-cache'), $url);
$message = sprintf(__('The object-cache.php Drop-In is outdated. Please click <strong>Re-Install</strong> to update it now. <br><br><a href="%s" style="min-width:100px;text-align:center;font-wight:bold;" class="button button-primary">Re-Install</a>', 'docket-cache'), $url);
}
} else {
/* translators: %1$s: url install, %2$s = url dismiss */
$message = $this->cf()->is_dctrue('OBJECTCACHEOFF', true) ? '' : sprintf(__('An unknown object-cache.php Drop-In was found. Please click <strong>Install</strong> to use Docket Cache. <br><br><a href="%1$s" class="button button-primary">Install</a>&nbsp;<a href="%2$s" class="button button-primary">Dismiss This Notice</a>', 'docket-cache'), $url, $urld);
$message = $this->cf()->is_dctrue('OBJECTCACHEOFF', true) ? '' : sprintf(__('An unknown object-cache.php Drop-In was found. Please click <strong>Install</strong> to use <strong>Docket Cache</strong>. <br><br><a href="%1$s" style="min-width:100px;text-align:center;font-weight:bold;" class="button button-primary button-small">Install</a>&nbsp;<a href="%2$s" style="min-width:100px;text-align:center;font-weight:bold;" class="button button-secondary button-small">Dismiss</a>', 'docket-cache'), $url, $urld);
}
}

Expand All @@ -1260,7 +1312,7 @@ function () {
}

if (isset($message)) {
echo Resc::boxmsg($message, 'warning', false, false);
echo Resc::boxmsg($message, 'warning', false, false, false);
}
}
);
Expand Down Expand Up @@ -1488,6 +1540,10 @@ function () use ($action) {
PHP_INT_MAX
);
break;
case 'autoupdate':
$action = 'enable' === $value ? true : false;
$this->plugin_autoupdates($action);
break;
}
},
-1,
Expand Down
8 changes: 6 additions & 2 deletions includes/src/Resc.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,14 @@ public static function spinner()
return 'data:image/gif;base64,'.$icon;
}

public static function boxmsg($msg, $type = 'info', $is_dismiss = true, $is_bold = true)
public static function boxmsg($msg, $type = 'info', $is_dismiss = true, $is_bold = true, $is_hide = true)
{
if (!empty($msg) && !empty($type)) {
$html = '<div id="docket-cache-notice" style="display:none;" class="notice notice-'.$type.($is_dismiss ? ' is-dismissible' : '').'"> ';
$html = '<div id="docket-cache-notice"';
if ($is_hide) {
$html .= ' style="display:none;" ';
}
$html .= 'class="notice notice-'.$type.($is_dismiss ? ' is-dismissible' : '').'"> ';
if ($is_bold) {
$html .= '<p><strong>'.$msg.'</strong></p>';
} else {
Expand Down
28 changes: 14 additions & 14 deletions languages/docket-cache.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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.11.04\n"
"Project-Id-Version: Docket Cache 20.11.05\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/docket-cache\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2020-12-21T13:26:49+00:00\n"
"POT-Creation-Date: 2020-12-22T16:37:42+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"
Expand Down Expand Up @@ -96,7 +96,7 @@ msgid "Run Garbage Collector"
msgstr ""

#: includes/admin/config.php:18
#: includes/src/Plugin.php:1164
#: includes/src/Plugin.php:1216
#: includes/src/View.php:291
msgid "Configuration"
msgstr ""
Expand All @@ -113,7 +113,7 @@ msgstr ""
#: includes/admin/config.php:38
#: includes/admin/log.php:21
#: includes/src/Canopt.php:79
#: includes/src/Plugin.php:1139
#: includes/src/Plugin.php:1191
#: includes/src/View.php:284
msgid "Cache Log"
msgstr ""
Expand Down Expand Up @@ -307,7 +307,7 @@ msgid "Not Available"
msgstr ""

#: includes/admin/cronbot.php:30
#: includes/src/Plugin.php:1152
#: includes/src/Plugin.php:1204
#: includes/src/View.php:288
msgid "Cronbot"
msgstr ""
Expand Down Expand Up @@ -456,8 +456,8 @@ msgid "Web Proxy"
msgstr ""

#: includes/admin/overview.php:35
#: includes/src/Plugin.php:1127
#: includes/src/Plugin.php:1423
#: includes/src/Plugin.php:1179
#: includes/src/Plugin.php:1475
#: includes/src/View.php:281
msgid "Overview"
msgstr ""
Expand Down Expand Up @@ -981,22 +981,22 @@ msgstr[0] ""
msgstr[1] ""

#. translators: %s: url
#: includes/src/Plugin.php:1250
msgid "The object-cache.php Drop-In is outdated. Please click <strong>Re-Install</strong> to update it now. <br><br><a href=\"%s\" class=\"button button-primary\">Re-Install</a>"
#: includes/src/Plugin.php:1302
msgid "The object-cache.php Drop-In is outdated. Please click <strong>Re-Install</strong> to update it now. <br><br><a href=\"%s\" style=\"min-width:100px;text-align:center;font-wight:bold;\" class=\"button button-primary\">Re-Install</a>"
msgstr ""

#. translators: %1$s: url install, %2$s = url dismiss
#: includes/src/Plugin.php:1254
msgid "An unknown object-cache.php Drop-In was found. Please click <strong>Install</strong> to use Docket Cache. <br><br><a href=\"%1$s\" class=\"button button-primary\">Install</a>&nbsp;<a href=\"%2$s\" class=\"button button-primary\">Dismiss This Notice</a>"
#: includes/src/Plugin.php:1306
msgid "An unknown object-cache.php Drop-In was found. Please click <strong>Install</strong> to use <strong>Docket Cache</strong>. <br><br><a href=\"%1$s\" style=\"min-width:100px;text-align:center;font-weight:bold;\" class=\"button button-primary button-small\">Install</a>&nbsp;<a href=\"%2$s\" style=\"min-width:100px;text-align:center;font-weight:bold;\" class=\"button button-secondary button-small\">Dismiss</a>"
msgstr ""

#: includes/src/Plugin.php:1259
#: includes/src/Plugin.php:1311
msgid "The Object Cache feature has been disabled at runtime."
msgstr ""

#. translators: %s: version
#: includes/src/Plugin.php:1390
#: includes/src/Plugin.php:1405
#: includes/src/Plugin.php:1442
#: includes/src/Plugin.php:1457
msgid "Version %s"
msgstr ""

Expand Down
8 changes: 7 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://www.patreon.com/bePatron?u=41796862
Requires at least: 5.4
Tested up to: 5.6
Requires PHP: 7.2.5
Stable tag: 20.11.04
Stable tag: 20.11.05
License: MIT
License URI: ./license.txt

Expand Down Expand Up @@ -174,6 +174,12 @@ Yes, you can. It can boost more your WordPress performance since there is no net
Please do manually remove wp-content/object-cache.php and wp-content/cache/docket-cache if an error occurs during updates. Thanks.

== Changelog ==
= 20.11.05 =

- Fixed CronAgent::check_connection() -> close_ping() -> Invalid selfcheck delay. Set to 90 minutes instead of now.
- Fixed Auto-updates -> wp >= 5.5 can't enable/disable auto-updates for docket cache at plugins page. Now, it works vise-versa.
- Fixed ReqAction -> Error notice undefined variable nv.

= 20.11.04 =

- Fixed Admin Interface -> filter others admin notice using hook.
Expand Down

0 comments on commit 184176e

Please sign in to comment.