diff --git a/changelog.txt b/changelog.txt index 881abba..a91413e 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,10 @@ += v23.08.02 (2023-11-13) = + +- Fixed: Tweaks::post_missed_schedule() -> Prevent post publish immediately. +- Fixed: WP_Object_Cache() -> Add setters and getters for backwards compatibility. +- Added: TWEAKS_SINGLESEARCHREDIRECT_DISABLED constant to disable redirection of single search results to the page. +- Updated: Tested up to 6.4. + = v23.08.01 (2023-08-19) = - Fixed: LimitBulkedit::bulk_editing_is_limited() -> Deprecated Constant FILTER_SANITIZE_STRING. diff --git a/dist/docket-cache.zip b/dist/docket-cache.zip index 7c3a30e..2777c8e 100644 Binary files a/dist/docket-cache.zip and b/dist/docket-cache.zip differ diff --git a/docket-cache.php b/docket-cache.php index 5553e8a..589b339 100644 --- a/docket-cache.php +++ b/docket-cache.php @@ -12,8 +12,8 @@ * @wordpress-plugin * Plugin Name: Docket Cache * Plugin URI: https://docketcache.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash - * Version: 23.08.01 - * VerPrev: 22.07.05 + * Version: 23.08.02 + * VerPrev: 23.08.01 * 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 c553360..cd34e80 100644 --- a/includes/cache.php +++ b/includes/cache.php @@ -263,6 +263,61 @@ public function __construct() $this->dc_init(); } + /** + * Makes private properties readable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name property to get + * + * @return mixed property + */ + public function __get($name) + { + return $this->$name; + } + + /** + * Makes private properties settable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name property to set + * @param mixed $value property value + * + * @return mixed newly-set property + */ + public function __set($name, $value) + { + return $this->$name = $value; + } + + /** + * Makes private properties checkable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name property to check if set + * + * @return bool whether the property is set + */ + public function __isset($name) + { + return isset($this->$name); + } + + /** + * Makes private properties un-settable for backward compatibility. + * + * @since 4.0.0 + * + * @param string $name property to unset + */ + public function __unset($name) + { + unset($this->$name); + } + /** * Serves as a utility function to determine whether a key exists in the cache. * diff --git a/includes/object-cache.php b/includes/object-cache.php index 08011aa..3ce82dd 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: 23.08.01 + * Version: 23.08.02 * Description: Object Cache drop-in for Docket Cache. * Author: Nawawi Jamili * Author URI: https://docketcache.com diff --git a/includes/src/Crawler.php b/includes/src/Crawler.php index f563a54..cb0e288 100644 --- a/includes/src/Crawler.php +++ b/includes/src/Crawler.php @@ -14,7 +14,7 @@ final class Crawler { - private static $version = '23.08.01'; + private static $version = '23.08.02'; public static $send_cookie = false; private static function default_args($param = []) diff --git a/includes/src/Tweaks.php b/includes/src/Tweaks.php index 63b5366..8e6e5b7 100644 --- a/includes/src/Tweaks.php +++ b/includes/src/Tweaks.php @@ -245,19 +245,21 @@ function ($post_id) { public function misc() { // wp: if only one post is found by the search results, redirect user to that post - add_action( - 'template_redirect', - function () { - if (is_search()) { - global $wp_query; - if (1 === (int) $wp_query->post_count && 1 === (int) $wp_query->max_num_pages) { - wp_redirect(get_permalink($wp_query->posts['0']->ID)); - exit; + if (nwdcx_consfalse('TWEAKS_SINGLESEARCHREDIRECT_DISABLED')) { + add_action( + 'template_redirect', + function () { + if (is_search()) { + global $wp_query; + if (1 === (int) $wp_query->post_count && 1 === (int) $wp_query->max_num_pages) { + wp_redirect(get_permalink($wp_query->posts['0']->ID)); + exit; + } } - } - }, - \PHP_INT_MAX - ); + }, + \PHP_INT_MAX + ); + } // wp: hide update notifications to non-admin users add_action( @@ -630,7 +632,6 @@ function () { $code .= 'script.src = src;'; $code .= 'script.async = true;'; $code .= 'document.head.appendChild(script);'; - $code .= ''; $code .= '}'; $code .= '}'; $code .= '};'; @@ -736,11 +737,12 @@ public function post_missed_schedule() ]; $post_types = get_post_types($args, 'names', 'and'); + $current_datetime = date('Y-m-d H:i:s'); if (!empty($post_types) && \is_array($post_types)) { $types = implode("','", $post_types); - $query = $wpdb->prepare("SELECT ID FROM `{$wpdb->posts}` WHERE post_type in ('post','page','%s') AND post_status='future' ORDER BY ID ASC LIMIT %d", $types, $limit); + $query = $wpdb->prepare("SELECT ID FROM `{$wpdb->posts}` WHERE post_type in ('post','page','%s') AND post_status='future' AND %s >= post_date_gmt ORDER BY ID ASC LIMIT %d", $types, $current_datetime, $limit); } else { - $query = $wpdb->prepare("SELECT ID FROM `{$wpdb->posts}` WHERE post_type in ('post','page') AND post_status='future' ORDER BY ID ASC LIMIT %d", $limit); + $query = $wpdb->prepare("SELECT ID FROM `{$wpdb->posts}` WHERE post_type in ('post','page') AND post_status='future' AND %s >= post_date_gmt ORDER BY ID ASC LIMIT %d", $current_datetime, $limit); } $results = $wpdb->get_results($query, ARRAY_A); diff --git a/languages/docket-cache.pot b/languages/docket-cache.pot index 3e90760..cc76205 100644 --- a/languages/docket-cache.pot +++ b/languages/docket-cache.pot @@ -2,14 +2,14 @@ # This file is distributed under the MIT. msgid "" msgstr "" -"Project-Id-Version: Docket Cache 23.08.01\n" +"Project-Id-Version: Docket Cache 23.08.02\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: 2023-08-19T13:14:48+00:00\n" +"POT-Creation-Date: 2023-11-13T01:07:27+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.7.1\n" "X-Domain: docket-cache\n" diff --git a/readme.txt b/readme.txt index 86eab90..20d82dd 100644 --- a/readme.txt +++ b/readme.txt @@ -2,9 +2,9 @@ Contributors: nawawijamili Tags: object cache, OPcache, cache, database, performance, Optimisation, redis, memcached, speed Requires at least: 5.4 -Tested up to: 6.3 +Tested up to: 6.4 Requires PHP: 7.2.5 -Stable tag: 23.08.01 +Stable tag: 23.08.02 License: MIT License URI: https://github.com/nawawi/docket-cache/blob/master/LICENSE.txt @@ -172,6 +172,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 == += 23.08.02 = +- Fixed: Tweaks::post_missed_schedule() -> Prevent post publish immediately. +- Fixed: WP_Object_Cache() -> Add setters and getters for backwards compatibility. +- Added: TWEAKS_SINGLESEARCHREDIRECT_DISABLED constant to disable redirection of single search results to the page. +- Updated: Tested up to 6.4. + = 23.08.01 = - Fixed: LimitBulkedit::bulk_editing_is_limited() -> Deprecated Constant FILTER_SANITIZE_STRING. - Fixed: restrict_api error notice.