Changeset 2156157
- Timestamp:
- 09/13/2019 01:34:51 PM (6 years ago)
- Location:
- runcache-purger/trunk
- Files:
-
- 4 edited
-
languages/runcachepurger.pot (modified) (3 diffs)
-
readme.txt (modified) (1 diff)
-
runcache-purger.php (modified) (8 diffs)
-
vendor/object-cache.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
runcache-purger/trunk/languages/runcachepurger.pot
r2155285 r2156157 5 5 msgstr "Project-Id-Version: RunCache Purger 1.0.0\n" 6 6 "Report-Msgid-Bugs-To: https://runcloud.io\n" 7 "POT-Creation-Date: 2019-09-1 2 14:23+0800\n"7 "POT-Creation-Date: 2019-09-13 21:30+0800\n" 8 8 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 9 9 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 38 38 msgstr "" 39 39 40 #: runcache-purger.php:54 4 runcache-purger.php:66340 #: runcache-purger.php:546 runcache-purger.php:665 41 41 msgid "Settings" 42 42 msgstr "" 43 43 44 #: runcache-purger.php:6 7844 #: runcache-purger.php:680 45 45 msgid "Clear Cache this Post" 46 46 msgstr "" 47 47 48 #: runcache-purger.php:6 8948 #: runcache-purger.php:691 49 49 msgid "Clear Cache this URL" 50 50 msgstr "" 51 51 52 #: runcache-purger.php: 699 views/settings.php:19452 #: runcache-purger.php:701 views/settings.php:197 53 53 msgid "Clear All Cache" 54 54 msgstr "" 55 55 56 #: runcache-purger.php:11 2456 #: runcache-purger.php:1130 57 57 msgid "Failed to purge cache." 58 58 msgstr "" 59 59 60 #: runcache-purger.php:113 160 #: runcache-purger.php:1137 61 61 msgid "Purging cache was successful." 62 62 msgstr "" 63 63 64 #: runcache-purger.php:113 364 #: runcache-purger.php:1139 65 65 msgid "Purging redis object cache was successful." 66 66 msgstr "" 67 67 68 #: runcache-purger.php:11 3868 #: runcache-purger.php:1144 69 69 #, php-format 70 70 msgid "Purging method not implement. Status Code %s" 71 71 msgstr "" 72 72 73 #: runcache-purger.php:114 373 #: runcache-purger.php:1149 74 74 msgid "Redis server not connected." 75 75 msgstr "" 76 76 77 #: runcache-purger.php:11 4577 #: runcache-purger.php:1151 78 78 msgid "Failed to purge redis object cache." 79 79 msgstr "" 80 80 81 #: runcache-purger.php:11 4881 #: runcache-purger.php:1154 82 82 msgid "Purging method not implement." 83 83 msgstr "" 84 84 85 #: runcache-purger.php:115 385 #: runcache-purger.php:1159 86 86 #, php-format 87 87 msgid "Failed to purge cache. Status Code %s" … … 173 173 msgstr "" 174 174 175 #: views/settings.php:1 47175 #: views/settings.php:150 176 176 msgid "Hostname" 177 177 msgstr "" 178 178 179 #: views/settings.php:15 0179 #: views/settings.php:153 180 180 msgid "Port" 181 181 msgstr "" 182 182 183 #: views/settings.php:15 3183 #: views/settings.php:156 184 184 msgid "Key Prefix" 185 185 msgstr "" 186 186 187 #: views/settings.php:16 0187 #: views/settings.php:163 188 188 msgid "Purge Object Cache" 189 189 msgstr "" 190 190 191 #: views/settings.php:16 4191 #: views/settings.php:167 192 192 msgid "Automatically clean redis object cache when any purge action was " 193 193 "triggered." 194 194 msgstr "" 195 195 196 #: views/settings.php:17 1196 #: views/settings.php:174 197 197 msgid "Enable Object Cache" 198 198 msgstr "" 199 199 200 #: views/settings.php:17 5200 #: views/settings.php:178 201 201 msgid "Enable this option to allow this plugin handle redis object cache." 202 202 msgstr "" 203 203 204 #: views/settings.php:1 89204 #: views/settings.php:192 205 205 msgid "Purge Actions" 206 206 msgstr "" 207 207 208 #: views/settings.php: 198208 #: views/settings.php:201 209 209 msgid "Clear Homepage Cache" 210 210 msgstr "" 211 211 212 #: views/settings.php:20 2212 #: views/settings.php:205 213 213 msgid "Clear Content Cache" 214 214 msgstr "" 215 215 216 #: views/settings.php:20 6216 #: views/settings.php:209 217 217 msgid "Clear Archives Cache" 218 218 msgstr "" 219 219 220 #: views/settings.php:21 0220 #: views/settings.php:213 221 221 msgid "Clear Redis Cache" 222 222 msgstr "" -
runcache-purger/trunk/readme.txt
r2154386 r2156157 1 1 === RunCache Purger (Alpha) === 2 Tags: runcloud, nginx, cache, redis, fastcgi 2 Contributors: fikrizaman,kamaroolkarim,hadian90 3 Tags: nginx, cache, redis, fastcgi 3 4 Requires at least: 5.1 4 5 Tested up to: 5.2 -
runcache-purger/trunk/runcache-purger.php
r2155908 r2156157 5 5 * Plugin URI: https://wordpress.org/plugins/runcache-purger/ 6 6 * Description: This plugin will purge RunCloud.io NGINX fastcgi, Proxy Cache and Redis Object Cache. 7 * Version: 1. 4.07 * Version: 1.5.0 8 8 * Author: RunCloud 9 9 * Author URI: https://profiles.wordpress.org/runcloud/ … … 64 64 65 65 // version 66 private static $version = '1. 4.0';67 private static $version_prev = '1. 3.0';66 private static $version = '1.5.0'; 67 private static $version_prev = '1.4.0'; 68 68 69 69 // later … … 443 443 { 444 444 445 self::flush_object(true);446 447 445 $file = RUNCACHE_PURGER_PATH_VENDOR . 'object-cache.php'; 448 446 if (!file_exists($file)) { … … 487 485 private static function uninstall_dropin() 488 486 { 489 self::flush_object(true);490 491 487 $file_dropin = self::get_dropin_file(); 492 488 if (file_exists($file_dropin) && defined('RUNCACHE_PURGER_DROPIN')) { … … 1674 1670 1675 1671 /** 1672 * __shutdown. 1673 */ 1674 private static function __shutdown() { 1675 add_action('shutdown', function() { 1676 wp_cache_flush(0); 1677 wp_cache_delete('alloptions', 'options'); 1678 1679 if ( function_exists('wp_cache_self_remove') && defined('RUNCACHE_PURGER_DROPIN') ) { 1680 wp_cache_self_remove(); 1681 } 1682 }); 1683 } 1684 1685 /** 1676 1686 * activate. 1677 1687 */ … … 1688 1698 { 1689 1699 self::force_site_deactivate_plugin(); 1690 // should clear everything, but there is a bug where options:alloptions keys were fetched and stored when deactivating 1691 self::flush_object(true); 1692 self::uninstall_dropin(); 1700 self::__shutdown(); 1693 1701 } 1694 1702 … … 1699 1707 { 1700 1708 self::uninstall_options(); 1701 self:: uninstall_dropin();1709 self::__shutdown(); 1702 1710 } 1703 1711 … … 1719 1727 self::uninstall_options(); 1720 1728 self::install_options(); 1721 self::install_dropin();1722 1729 } 1723 1730 -
runcache-purger/trunk/vendor/object-cache.php
r2155285 r2156157 62 62 } 63 63 64 function wp_cache_delete($key, $group = '' , $time = 0)65 { 66 global $wp_object_cache; 67 68 return $wp_object_cache->delete($key, $group , $time);64 function wp_cache_delete($key, $group = '') 65 { 66 global $wp_object_cache; 67 68 return $wp_object_cache->delete($key, $group); 69 69 } 70 70 … … 143 143 } 144 144 145 function wp_cache_redis_stats_array() 146 { 147 global $wp_object_cache; 148 149 return $wp_object_cache->stats_array(); 145 function wp_cache_self_remove() 146 { 147 @unlink(__FILE__); 150 148 } 151 149 … … 426 424 } 427 425 428 private function sanitize_key_prefix($prefix) {429 if ( preg_match('/[\'\/~`\!@#\$%\^&\*\(\)_\-\+=\{\}\[\]\|;:"\<\>,\.\?\\\]/', $prefix) ) {430 return md5($prefix);431 }432 433 return $prefix;434 }435 436 426 public function flush($delay = 0) 437 427 { … … 447 437 if ($this->redis_status()) { 448 438 $salt = defined('RUNCACHE_PURGER_DROPIN_PREFIX') ? trim(RUNCACHE_PURGER_DROPIN_PREFIX) : null; 449 if ( !empty($salt) ) {450 $salt = $this->sanitize_key_prefix($salt);451 }452 453 439 $selective = defined('WP_REDIS_SELECTIVE_FLUSH') ? WP_REDIS_SELECTIVE_FLUSH : null; 454 440 … … 732 718 } 733 719 734 public function stats_array() {735 return [736 'status' => ( $this->redis_status() ? 'Connected' : 'Not Connected' ),737 'client' => $this->redis_client,738 'hit' => $this->cache_hits,739 'miss' => $this->cache_misses,740 ];741 }742 743 720 public function build_key($key, $group = 'default') 744 721 { … … 748 725 749 726 $salt = defined('RUNCACHE_PURGER_DROPIN_PREFIX') ? trim(RUNCACHE_PURGER_DROPIN_PREFIX) : ''; 750 if ( !empty($salt) ) {751 $salt = $this->sanitize_key_prefix($salt);752 }753 754 727 $prefix = in_array($group, $this->global_groups) ? $this->global_prefix : $this->blog_prefix; 755 756 728 return "{$salt}{$prefix}:{$group}:{$key}"; 757 729 }
Note: See TracChangeset
for help on using the changeset viewer.