Skip to content

Commit

Permalink
bump 21.08.06
Browse files Browse the repository at this point in the history
- Fixed: WP_Object_Cache::dc_close() -> Remove stale cache abandoned by WordPress, WooCommerce, Advanced Post Cache after doing cache invalidation.
- Fixed: WP_Object_Cache::dc_get() -> The transient should return false if does not have a value or has expired.
- Fixed: WP_Object_Cache::dc_get() -> Run maybe_unserialize to check and unserialize string data when failed to convert into an array.
- Fixed: WP_Object_Cache::dc_save() -> Reduce cache miss if contain objects of headers remote requests.
- Fixed: WP_Object_Cache::dc_save() -> Return true and avoid storing on disk if the transient has no value.
- Fixed: WP_Object_Cache() -> dc_precache_load(), dc_precache_set() -> Do check precache max list.
- Fixed: Tweaks() -> wpbrowsehappy(),wpservehappy() -> Use the pre_site_transient filter instead of blocking API requests, makes the query monitor happy.
- Fixed: RecursiveDirectoryIterator -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: WP_Object_Cache() -> dc_precache_load(), dc_precache_set() -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: Event() -> optimizedb(), garbage_collector() -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: CronAgent::run_wpcron() -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: Tweaks::wpembed() -> Invalid body_class hook arguments.
- Fixed: Plugin::get_opcache_status() -> OPcache File Cache Only -> Use getATime instead of getMTime to match with in-memory last_used_timestamp.
- Fixed: Overview -> Object Cache -> Data is not updated when opcache is not available.
- Fixed: Overview -> Flush Object Cache -> Immediately remove the cache file instead of truncate.
- Added: WP-CLI command -> flush:transient, flush:advcpost, flush:menucache.
- Added: wp_cache_flush_runtime(), wp_cache_*_multiple() functions.
- Added: wp_cache_flush_group_match() -> Remove cache file match with the group name in files.
- Added: WP_Object_Cache::dc_stalecache_filter() -> Capture cache key pattern match with the stale cache.
- Added: WP_Object_Cache::add_stalecache() -> Set a list of stale cache to remove when Object Cache shutdown.
- Added: Configuration -> Admin Interface -> Additional Flush Cache Action Button.
- Added: Configuration -> Cache Options -> Post Caching Any Post Type.
- Added: Configuration -> Storage Options -> Chunk Cache Directory, Auto Remove Stale Cache, Cache Files Limit, Cache Disk Limit.
- Added: Opcache Viewer -> Possible to display a notice if the current site path has been blacklisted in opcache.blacklist_filename directive.
- Added: DOCKET_CACHE_CHUNKCACHEDIR constant to enable chunk cache files into a smaller directory to avoid an excessive number of cache files in a single directory.
- Added: DOCKET_CACHE_ADVCPOST_POSTTYPE constant to allow cache other post types.
- Added: DOCKET_CACHE_ADVCPOST_POSTTYPE_ALL constant to allow cache any post types.
- Added: DOCKET_CACHE_FLUSH_STALECACHE constant to enable auto remove stale cache.
- Added: DOCKET_CACHE_PRECACHE_MAXLIST constant to limit cache entries per URL.
- Added: DOCKET_CACHE_IGNORE_REQUEST constant to bypass object cache match key from POST, GET variables.
  • Loading branch information
nawawi committed May 13, 2022
1 parent aae4a66 commit 5ddf0df
Show file tree
Hide file tree
Showing 31 changed files with 2,732 additions and 1,043 deletions.
35 changes: 35 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
= v21.08.06 (2022-05-13) =

- Fixed: WP_Object_Cache::dc_close() -> Remove stale cache abandoned by WordPress, WooCommerce, Advanced Post Cache after doing cache invalidation.
- Fixed: WP_Object_Cache::dc_get() -> The transient should return false if does not have a value or has expired.
- Fixed: WP_Object_Cache::dc_get() -> Run maybe_unserialize to check and unserialize string data when failed to convert into an array.
- Fixed: WP_Object_Cache::dc_save() -> Reduce cache miss if contain objects of headers remote requests.
- Fixed: WP_Object_Cache::dc_save() -> Return true and avoid storing on disk if the transient has no value.
- Fixed: WP_Object_Cache() -> dc_precache_load(), dc_precache_set() -> Do check precache max list.
- Fixed: Tweaks() -> wpbrowsehappy(),wpservehappy() -> Use the pre_site_transient filter instead of blocking API requests, makes the query monitor happy.
- Fixed: RecursiveDirectoryIterator -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: WP_Object_Cache() -> dc_precache_load(), dc_precache_set() -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: Event() -> optimizedb(), garbage_collector() -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: CronAgent::run_wpcron() -> Do check max_execution_time to avoid a fatal timeout.
- Fixed: Tweaks::wpembed() -> Invalid body_class hook arguments.
- Fixed: Plugin::get_opcache_status() -> OPcache File Cache Only -> Use getATime instead of getMTime to match with in-memory last_used_timestamp.
- Fixed: Overview -> Object Cache -> Data is not updated when opcache is not available.
- Fixed: Overview -> Flush Object Cache -> Immediately remove the cache file instead of truncate.
- Added: WP-CLI command -> flush:transient, flush:advcpost, flush:menucache.
- Added: wp_cache_flush_runtime(), wp_cache_*_multiple() functions.
- Added: wp_cache_flush_group_match() -> Remove cache file match with the group name in files.
- Added: WP_Object_Cache::dc_stalecache_filter() -> Capture cache key pattern match with the stale cache.
- Added: WP_Object_Cache::add_stalecache() -> Set a list of stale cache to remove when Object Cache shutdown.
- Added: Configuration -> Admin Interface -> Additional Flush Cache Action Button.
- Added: Configuration -> Cache Options -> Post Caching Any Post Type.
- Added: Configuration -> Storage Options -> Chunk Cache Directory, Auto Remove Stale Cache, Cache Files Limit, Cache Disk Limit.
- Added: Opcache Viewer -> Possible to display a notice if the current site path has been blacklisted in opcache.blacklist_filename directive.
- Added: DOCKET_CACHE_CHUNKCACHEDIR constant to enable chunk cache files into a smaller directory to avoid an excessive number of cache files in a single directory.
- Added: DOCKET_CACHE_ADVCPOST_POSTTYPE constant to allow cache other post types.
- Added: DOCKET_CACHE_ADVCPOST_POSTTYPE_ALL constant to allow cache any post types.
- Added: DOCKET_CACHE_FLUSH_STALECACHE constant to enable auto remove stale cache.
- Added: DOCKET_CACHE_PRECACHE_MAXLIST constant to limit cache entries per URL.
- Added: DOCKET_CACHE_IGNORE_REQUEST constant to bypass object cache match key from POST, GET variables.

Thanks to Jordan from @websavers for improvement feedback.

= v21.08.05 (2022-04-22) =

- Fixed: object-cache.php -> Checking is file object-cache-delay.txt.
Expand Down
Binary file modified dist/docket-cache.zip
Binary file not shown.
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://docketcache.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash
* Version: 21.08.05
* VerPrev: 21.08.04
* Version: 21.08.06
* VerPrev: 21.08.05
* 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
98 changes: 97 additions & 1 deletion includes/admin/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@
<?php echo $this->config_select_bool('advcpost'); ?>
</td>
</tr>
<?php if ($this->vcf()->is_dctrue('advcpost')) : ?>
<tr id="advpost_posttype_all">
<th><?php echo esc_html__('Post Caching Any Post Type', 'docket-cache').$this->tooltip('advpost_posttype_all'); ?></th>
<td>
<?php echo $this->config_select_bool('advpost_posttype_all'); ?>
</td>
</tr>
<?php endif; ?>

<tr id="precache">
<th><?php echo esc_html__('Object Cache Precaching', 'docket-cache').$this->tooltip('precache'); ?></th>
<td>
Expand Down Expand Up @@ -456,6 +465,81 @@
</td>
</tr>
<?php endif; ?>
<tr>
<td colspan="2" class="stitle">
<?php esc_html_e('Storage Options', 'docket-cache'); ?>
</td>
</tr>
<tr id="chunkcachedir">
<th><?php echo esc_html__('Chunk Cache Directory', 'docket-cache').$this->tooltip('chunkcachedir'); ?></th>
<td>
<?php echo $this->config_select_bool('chunkcachedir'); ?>
</td>
</tr>
<tr id="flush_stalecache">
<th><?php echo esc_html__('Auto Remove Stale Cache', 'docket-cache').$this->tooltip('flush_stalecache'); ?></th>
<td>
<?php echo $this->config_select_bool('flush_stalecache'); ?>
</td>
</tr>
<tr id="maxfile">
<th><?php echo esc_html__('Cache Files Limit', 'docket-cache').$this->tooltip('maxfile'); ?></th>
<td>
<?php
$maxfile_default = '50K';
switch ($this->vcf()->dcvalue('maxfile')) {
case '50000':
$maxfile_default = '50K';
break;
case '100000':
$maxfile_default = '100K';
break;
case '200000':
$maxfile_default = '200K';
break;
}
echo $this->config_select_set(
'maxfile',
[
'default' => __('Default', 'docket-cache'),
'50K' => '50000',
'100K' => '100000',
'200K' => '200000',
],
$maxfile_default
);
?>
</td>
</tr>
<tr id="maxsize_disk">
<th class="border-b"><?php echo esc_html__('Cache Disk Limit', 'docket-cache').$this->tooltip('maxsize_disk'); ?></th>
<td>
<?php
$maxsize_disk_default = '500M';
switch ($this->vcf()->dcvalue('maxsize_disk')) {
case '524288000':
$maxsize_disk_default = '500M';
break;
case '1073741824':
$maxsize_disk_default = '1G';
break;
case '2147483648':
$maxsize_disk_default = '2G';
break;
}
echo $this->config_select_set(
'maxsize_disk',
[
'default' => __('Default', 'docket-cache'),
'500M' => '500M',
'1G' => '1G',
'2G' => '2G',
],
$maxsize_disk_default
);
?>
</td>
</tr>
<tr>
<td colspan="2" class="stitle">
<?php esc_html_e('Admin Interface', 'docket-cache'); ?>
Expand All @@ -474,11 +558,17 @@
</td>
</tr>
<tr id="gcaction">
<th class="border-b"><?php echo esc_html__('Garbage Collector Action Button', 'docket-cache').$this->tooltip('gcaction'); ?></th>
<th><?php echo esc_html__('Garbage Collector Action Button', 'docket-cache').$this->tooltip('gcaction'); ?></th>
<td>
<?php echo $this->config_select_bool('gcaction'); ?>
</td>
</tr>
<tr id="flushaction">
<th class="border-b"><?php echo esc_html__('Additional Flush Cache Action Button', 'docket-cache').$this->tooltip('flushaction'); ?></th>
<td>
<?php echo $this->config_select_bool('flushaction'); ?>
</td>
</tr>
<tr>
<td colspan="2" class="stitle">
<?php esc_html_e('Plugin Options', 'docket-cache'); ?>
Expand All @@ -496,6 +586,12 @@
<?php echo $this->config_select_bool('checkversion'); ?>
</td>
</tr>
<tr id="flush_shutdown">
<th><?php echo esc_html__('Flush Object Cache During Deactivation', 'docket-cache').$this->tooltip('flush_shutdown'); ?></th>
<td>
<?php echo $this->config_select_bool('flush_shutdown'); ?>
</td>
</tr>
<tr id="opcshutdown">
<th><?php echo esc_html__('Flush OPcache During Deactivation', 'docket-cache').$this->tooltip('opcshutdown'); ?></th>
<td>
Expand Down
10 changes: 9 additions & 1 deletion includes/admin/docket.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*
* @see https://github.com/nawawi/docket-cache
*/

body {
background-color: #f5f5f5;
}
Expand Down Expand Up @@ -858,6 +857,15 @@ body {
min-width: 200px;
}

#docket-cache .gc li span.single {
min-width: 0;
}

#docket-cache .gc li span.bulllist {
margin-top: 10px;
min-width: 0;
}

/* tooltip */
#docket-cache [data-tooltip] {
position: relative;
Expand Down
8 changes: 0 additions & 8 deletions includes/admin/docket.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,6 @@
.on(
'change.dc-select-config-filter',
function() {
/*var $self = $( this );
var s = $self.children( 'option:selected' )
.val();
var f = 'all' !== s ? '@filter:' + s : '';
$selector.find( 'input[type=search][name=s]' )
.val( f );
$selector.find( 'form#search-filter' )
.submit();*/
$selector.find( 'form#config-filter' )
.submit();
return false;
Expand Down
18 changes: 17 additions & 1 deletion includes/admin/opcviewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,26 @@
}
break;
}
$blacklist = [];
if ('opcache.blacklist_filename' === $k) {
$files = glob($v);
if (!empty($files) && \is_array($files)) {
$blacklist = $files;
}
unset($files);
}
?>
<tr>
<th><a href="<?php echo $opcache_view->get_doc($k); ?>" rel="noopener" target="new"><?php echo $k; ?></a><span class="rsep">:</span></th>
<td><?php echo $v; ?></td>
</tr>
<?php if (!empty($blacklist)) : ?>
<tr>
<th></th>
<td><small><?php echo implode('<br>', $blacklist); ?></small></td>
</tr>
<?php endif; ?>

<?php endforeach; ?>
</table>
<p class="submit">
Expand All @@ -93,6 +108,8 @@

if (!$this->pt->opcache_function_exists('opcache_get_status')) {
echo Resc::boxmsg(__('No data is available. The opcache_get_status function disabled in PHP configuration.', 'docket-cache'), 'warning', false, true, false);
} elseif ($this->pt->is_opcache_blacklisted()) {
echo Resc::boxmsg(__("This site's local path has been blacklisted by OPcache configuration, which prevents it from caching.", 'docket-cache'), 'warning', false, true, false);
}

$stats = $opcache_view->get_usage();
Expand Down Expand Up @@ -191,7 +208,6 @@

<?php $this->tab_title(esc_html__('OPcache Files', 'docket-cache'), 'title-below'); ?>
<div class="gridlist grid-opclist border-t">

<div class="box-left">
<form id="config-filter" method="get" action="<?php echo esc_url($this->pt->get_page()); ?>">
<input type="hidden" name="page" value="docket-cache-opcviewer">
Expand Down
9 changes: 7 additions & 2 deletions includes/admin/overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<?php else : ?>
<tr>
<th><?php esc_html_e('Object Cache', 'docket-cache'); ?></th>
<td id="objectcache0-stats">
<td id="objectcache-stats">
<?php
echo 1 === $this->info->status_code && !empty($this->info->status_text_stats) ? $this->info->status_text_stats : $this->info->status_text;
?>
Expand Down Expand Up @@ -169,10 +169,15 @@
</tr>

<tr>
<th class="border-b"><?php esc_html_e('Cache Path', 'docket-cache'); ?></th>
<th><?php esc_html_e('Cache Path', 'docket-cache'); ?></th>
<td><?php echo $this->info->cache_path; ?></td>
</tr>

<tr>
<th class="border-b"><?php esc_html_e('Chunk Cache Directory', 'docket-cache'); ?></th>
<td><?php echo $this->info->cache_chunkdir; ?></td>
</tr>

<tr>
<th><?php esc_html_e('Config Writable', 'docket-cache'); ?></th>
<td><?php echo $this->info->write_config; ?></td>
Expand Down
38 changes: 38 additions & 0 deletions includes/admin/resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@
<?php endif; ?>
<a href="<?php echo $this->pt->action_query('cleanuppost', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner btx-cleanuppost"><?php esc_html_e('Cleanup Post', 'docket-cache'); ?></a>

<?php if ($this->vcf()->is_dctrue('FLUSHACTION')) : ?>
<?php if ($this->vcf()->is_dctrue('ADVCPOST')) : ?>
<hr>
<h4><?php esc_html_e('Advanced Post Cache Files', 'docket-cache'); ?></h4>
<p>
<?php esc_html_e('Remove Advanced Post Cache files.', 'docket-cache'); ?>
</p>
<a href="<?php echo $this->pt->action_query('flush-advcpost', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Flush Advanced Post Cache', 'docket-cache'); ?></a>
<?php endif; ?>

<?php if ($this->vcf()->is_dctrue('PRECACHE')) : ?>
<hr>
<h4><?php esc_html_e('Object Precache Files', 'docket-cache'); ?></h4>
<p>
<?php esc_html_e('Remove Object Cache Precaching files.', 'docket-cache'); ?>
</p>
<a href="<?php echo $this->pt->action_query('flush-ocprecache', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Flush Object Precache', 'docket-cache'); ?></a>
<?php endif; ?>

<hr>
<h4><?php esc_html_e('Transient Cache Files', 'docket-cache'); ?></h4>
<p>
<?php esc_html_e('Remove transient cache files.', 'docket-cache'); ?>
</p>
<a href="<?php echo $this->pt->action_query('flush-transient', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Flush Transient Cache', 'docket-cache'); ?></a>

<?php if ($this->vcf()->is_dctrue('MENUCACHE')) : ?>
<hr>
<h4><?php esc_html_e('Menu Cache Files', 'docket-cache'); ?></h4>
Expand All @@ -48,12 +74,24 @@
</p>
<a href="<?php echo $this->pt->action_query('flush-menucache', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Flush Menu Cache', 'docket-cache'); ?></a>
<?php endif; ?>

<?php if ($this->vcf()->is_dctrue('MOCACHE')) : ?>
<hr>
<h4><?php esc_html_e('Translation Cache Files', 'docket-cache'); ?></h4>
<p>
<?php esc_html_e('Remove translation cache files.', 'docket-cache'); ?>
</p>
<a href="<?php echo $this->pt->action_query('flush-mocache', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Flush Translation Cache', 'docket-cache'); ?></a>
<?php endif; ?>

<?php endif; // flushaction?>
<hr>
<h4><?php esc_html_e('Config Reset', 'docket-cache'); ?></h4>
<p>
<?php esc_html_e('Reset all configuration to default.', 'docket-cache'); ?>
</p>
<a href="<?php echo $this->pt->action_query('configreset', ['idx' => 'config']); ?>" class="button button-primary button-large btx-spinner"><?php esc_html_e('Reset to default', 'docket-cache'); ?></a>

<hr>
<h4><?php esc_html_e('Runtime Code', 'docket-cache'); ?></h4>
<p>
Expand Down
Loading

0 comments on commit 5ddf0df

Please sign in to comment.