Changeset 3078450
- Timestamp:
- 04/29/2024 07:12:03 AM (2 years ago)
- Location:
- powered-cache
- Files:
-
- 12 edited
- 1 copied
-
tags/3.4.4 (copied) (copied from powered-cache/trunk)
-
tags/3.4.4/includes/classes/AdvancedCache.php (modified) (3 diffs)
-
tags/3.4.4/includes/compat/domain-mapping.php (modified) (4 diffs)
-
tags/3.4.4/includes/utils.php (modified) (2 diffs)
-
tags/3.4.4/languages/powered-cache.pot (modified) (3 diffs)
-
tags/3.4.4/powered-cache.php (modified) (2 diffs)
-
tags/3.4.4/readme.txt (modified) (2 diffs)
-
trunk/includes/classes/AdvancedCache.php (modified) (3 diffs)
-
trunk/includes/compat/domain-mapping.php (modified) (4 diffs)
-
trunk/includes/utils.php (modified) (2 diffs)
-
trunk/languages/powered-cache.pot (modified) (3 diffs)
-
trunk/powered-cache.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
powered-cache/tags/3.4.4/includes/classes/AdvancedCache.php
r3038477 r3078450 79 79 add_action( 'transition_post_status', array( $this, 'purge_on_post_update' ), 9999, 3 ); 80 80 add_action( 'switch_theme', array( $this, 'purge_on_switch_theme' ) ); 81 add_action( 'wp_set_comment_status', array( $this, 'purge_post_on_comment_status_change' ), 10, 2 ); 81 add_action( 'wp_set_comment_status', array( $this, 'purge_post_on_comment_update' ) ); 82 add_action( 'edit_comment', array( $this, 'purge_post_on_comment_update' ) ); 82 83 add_action( 'set_comment_cookies', array( $this, 'set_comment_cookie' ), 10, 2 ); 83 84 add_filter( 'powered_cache_post_related_urls', array( $this, 'powered_cache_post_related_urls' ) ); … … 283 284 284 285 /** 285 * Delete page cache when post update286 * Purge post cache when comment status change 286 287 * 287 288 * @param int $comment_id Comment ID 288 * @param string $comment_status Status of the comment 289 * 290 * @since 1.0 289 * @param string $comment_status Comment status 290 * 291 * @return void 292 * @deprecated since 3.4.4 291 293 */ 292 294 public function purge_post_on_comment_status_change( $comment_id, $comment_status ) { 295 // deprecate this method in favor of `purge_post_on_comment_update` 296 _deprecated_function( __METHOD__, '3.4.4', 'purge_post_on_comment_update' ); 297 $this->purge_post_on_comment_update( $comment_id ); 293 298 $comment = get_comment( $comment_id ); 294 299 $post_id = $comment->comment_post_ID; 295 300 $post_url = get_permalink( $post_id ); 296 delete_page_cache( $post_url ); 301 302 do_action( 'powered_cache_advanced_cache_purge_on_comment_update', $post_id, $post_url, $comment_id ); 303 } 304 305 /** 306 * Delete page cache when a comment update 307 * 308 * @param int $comment_id Comment ID 309 * 310 * @since 3.4.4 311 */ 312 public function purge_post_on_comment_update( $comment_id ) { 313 $comment = get_comment( $comment_id ); 314 $post_id = $comment->comment_post_ID; 315 $post_url = get_permalink( $post_id ); 316 delete_page_cache( $post_url, true ); 297 317 298 318 /** 299 319 * Fires after purging cache for a post that associated a comment 320 * 321 * @hook powered_cache_advanced_cache_purge_on_comment_update 300 322 * 301 323 * @param {int} $post_id Post ID. … … 303 325 * @param {int} $comment_id Comment ID. 304 326 * 305 * @since 2.0306 */ 307 do_action( 'powered_cache_advanced_cache_purge_on_comment_ status_change', $post_id, $post_url, $comment_id );327 * @since 3.4.4 328 */ 329 do_action( 'powered_cache_advanced_cache_purge_on_comment_update', $post_id, $post_url, $comment_id ); 308 330 } 309 331 -
powered-cache/tags/3.4.4/includes/compat/domain-mapping.php
r3016660 r3078450 19 19 add_action( 'powered_cache_clean_site_cache_dir', __NAMESPACE__ . '\\maybe_clean_mapped_domain_dir' ); 20 20 add_action( 'powered_cache_advanced_cache_purge_post', __NAMESPACE__ . '\\maybe_purge_on_post_update', 10, 2 ); 21 add_action( 'powered_cache_advanced_cache_purge_on_comment_ status_change', __NAMESPACE__ . '\\maybe_purge_on_comment_status_change', 10, 2 );21 add_action( 'powered_cache_advanced_cache_purge_on_comment_update', __NAMESPACE__ . '\\maybe_purge_on_comment_update', 10, 2 ); 22 22 add_action( 'powered_cache_create_config_file', __NAMESPACE__ . '\\maybe_create_config_files', 10, 3 ); 23 23 add_action( 'wp_delete_site', __NAMESPACE__ . '\\purge_on_site_delete' ); // works on WP 5.1+ … … 92 92 $new_purge_urls = str_replace( site_url(), $domain, $urls ); 93 93 foreach ( $new_purge_urls as $new_purge_url ) { 94 delete_page_cache( $new_purge_url );94 delete_page_cache( $new_purge_url, true ); 95 95 } 96 96 } … … 103 103 * @param string $post_url Post ID of the comment. 104 104 */ 105 function maybe_purge_on_comment_ status_change( $post_id, $post_url ) {105 function maybe_purge_on_comment_update( $post_id, $post_url ) { 106 106 $mapped_domains = get_mapped_domains(); 107 107 if ( ! $mapped_domains ) { … … 111 111 foreach ( $mapped_domains as $domain ) { 112 112 $post_url = str_replace( site_url(), $domain, $post_url ); 113 delete_page_cache( $post_url );113 delete_page_cache( $post_url, true ); 114 114 } 115 115 } -
powered-cache/tags/3.4.4/includes/utils.php
r3038477 r3078450 891 891 * Delete cache file 892 892 * 893 * @param string $url Target URL 893 * @param string $url Target URL 894 * @param bool $delete_subdirectories Whether delete subdirectories or not 894 895 * 895 896 * @return bool true when found cache dir, otherwise false 896 897 * @since 1.0 897 898 */ 898 function delete_page_cache( $url ) { 899 899 function delete_page_cache( $url, $delete_subdirectories = false ) { 900 900 $dir = get_url_dir( trim( $url ) ); 901 901 … … 912 912 } 913 913 914 if ( file_exists( $dir ) && is_dir_empty( $dir) ) {914 if ( file_exists( $dir ) && ( $delete_subdirectories || is_dir_empty( $dir ) ) ) { 915 915 remove_dir( $dir ); 916 916 } -
powered-cache/tags/3.4.4/languages/powered-cache.pot
r3074892 r3078450 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Powered Cache 3.4. 3\n"5 "Project-Id-Version: Powered Cache 3.4.4\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/powered-cache\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024-04-2 2T09:13:19+00:00\n"12 "POT-Creation-Date: 2024-04-29T07:07:13+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.9.0\n" … … 1498 1498 msgstr "" 1499 1499 1500 #: includes/classes/AdvancedCache.php:10 41500 #: includes/classes/AdvancedCache.php:105 1501 1501 msgid "Purge Page Cache [Network Wide - All Sites]" 1502 1502 msgstr "" 1503 1503 1504 #: includes/classes/AdvancedCache.php:11 51504 #: includes/classes/AdvancedCache.php:116 1505 1505 msgid "Purge Page Cache" 1506 1506 msgstr "" 1507 1507 1508 #: includes/classes/AdvancedCache.php:12 51508 #: includes/classes/AdvancedCache.php:126 1509 1509 msgid "Purge Current Page" 1510 1510 msgstr "" -
powered-cache/tags/3.4.4/powered-cache.php
r3074892 r3078450 4 4 * Plugin URI: https://poweredcache.com 5 5 * Description: Powered Cache is the most powerful caching and performance suite for WordPress, designed to easily improve your PageSpeed and Web Vitals Score. 6 * Version: 3.4. 36 * Version: 3.4.4 7 7 * Requires at least: 5.7 8 8 * Requires PHP: 7.2.5 … … 26 26 27 27 // Useful global constants. 28 define( 'POWERED_CACHE_VERSION', '3.4. 3' );28 define( 'POWERED_CACHE_VERSION', '3.4.4' ); 29 29 define( 'POWERED_CACHE_DB_VERSION', '3.4' ); 30 30 define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); -
powered-cache/tags/3.4.4/readme.txt
r3074892 r3078450 4 4 Requires at least: 5.7 5 5 Tested up to: 6.5 6 Stable tag: 3.4. 36 Stable tag: 3.4.4 7 7 License: GPLv2 (or later) 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 171 171 172 172 == Changelog == 173 174 = 3.4.4 (April 29, 2024) = 175 - [Fixed] Resolved an issue with comment cache not purging correctly. 176 - [Added] Support for purging paginated comments. 173 177 174 178 = 3.4.3 (April 22, 2024) = -
powered-cache/trunk/includes/classes/AdvancedCache.php
r3038477 r3078450 79 79 add_action( 'transition_post_status', array( $this, 'purge_on_post_update' ), 9999, 3 ); 80 80 add_action( 'switch_theme', array( $this, 'purge_on_switch_theme' ) ); 81 add_action( 'wp_set_comment_status', array( $this, 'purge_post_on_comment_status_change' ), 10, 2 ); 81 add_action( 'wp_set_comment_status', array( $this, 'purge_post_on_comment_update' ) ); 82 add_action( 'edit_comment', array( $this, 'purge_post_on_comment_update' ) ); 82 83 add_action( 'set_comment_cookies', array( $this, 'set_comment_cookie' ), 10, 2 ); 83 84 add_filter( 'powered_cache_post_related_urls', array( $this, 'powered_cache_post_related_urls' ) ); … … 283 284 284 285 /** 285 * Delete page cache when post update286 * Purge post cache when comment status change 286 287 * 287 288 * @param int $comment_id Comment ID 288 * @param string $comment_status Status of the comment 289 * 290 * @since 1.0 289 * @param string $comment_status Comment status 290 * 291 * @return void 292 * @deprecated since 3.4.4 291 293 */ 292 294 public function purge_post_on_comment_status_change( $comment_id, $comment_status ) { 295 // deprecate this method in favor of `purge_post_on_comment_update` 296 _deprecated_function( __METHOD__, '3.4.4', 'purge_post_on_comment_update' ); 297 $this->purge_post_on_comment_update( $comment_id ); 293 298 $comment = get_comment( $comment_id ); 294 299 $post_id = $comment->comment_post_ID; 295 300 $post_url = get_permalink( $post_id ); 296 delete_page_cache( $post_url ); 301 302 do_action( 'powered_cache_advanced_cache_purge_on_comment_update', $post_id, $post_url, $comment_id ); 303 } 304 305 /** 306 * Delete page cache when a comment update 307 * 308 * @param int $comment_id Comment ID 309 * 310 * @since 3.4.4 311 */ 312 public function purge_post_on_comment_update( $comment_id ) { 313 $comment = get_comment( $comment_id ); 314 $post_id = $comment->comment_post_ID; 315 $post_url = get_permalink( $post_id ); 316 delete_page_cache( $post_url, true ); 297 317 298 318 /** 299 319 * Fires after purging cache for a post that associated a comment 320 * 321 * @hook powered_cache_advanced_cache_purge_on_comment_update 300 322 * 301 323 * @param {int} $post_id Post ID. … … 303 325 * @param {int} $comment_id Comment ID. 304 326 * 305 * @since 2.0306 */ 307 do_action( 'powered_cache_advanced_cache_purge_on_comment_ status_change', $post_id, $post_url, $comment_id );327 * @since 3.4.4 328 */ 329 do_action( 'powered_cache_advanced_cache_purge_on_comment_update', $post_id, $post_url, $comment_id ); 308 330 } 309 331 -
powered-cache/trunk/includes/compat/domain-mapping.php
r3016660 r3078450 19 19 add_action( 'powered_cache_clean_site_cache_dir', __NAMESPACE__ . '\\maybe_clean_mapped_domain_dir' ); 20 20 add_action( 'powered_cache_advanced_cache_purge_post', __NAMESPACE__ . '\\maybe_purge_on_post_update', 10, 2 ); 21 add_action( 'powered_cache_advanced_cache_purge_on_comment_ status_change', __NAMESPACE__ . '\\maybe_purge_on_comment_status_change', 10, 2 );21 add_action( 'powered_cache_advanced_cache_purge_on_comment_update', __NAMESPACE__ . '\\maybe_purge_on_comment_update', 10, 2 ); 22 22 add_action( 'powered_cache_create_config_file', __NAMESPACE__ . '\\maybe_create_config_files', 10, 3 ); 23 23 add_action( 'wp_delete_site', __NAMESPACE__ . '\\purge_on_site_delete' ); // works on WP 5.1+ … … 92 92 $new_purge_urls = str_replace( site_url(), $domain, $urls ); 93 93 foreach ( $new_purge_urls as $new_purge_url ) { 94 delete_page_cache( $new_purge_url );94 delete_page_cache( $new_purge_url, true ); 95 95 } 96 96 } … … 103 103 * @param string $post_url Post ID of the comment. 104 104 */ 105 function maybe_purge_on_comment_ status_change( $post_id, $post_url ) {105 function maybe_purge_on_comment_update( $post_id, $post_url ) { 106 106 $mapped_domains = get_mapped_domains(); 107 107 if ( ! $mapped_domains ) { … … 111 111 foreach ( $mapped_domains as $domain ) { 112 112 $post_url = str_replace( site_url(), $domain, $post_url ); 113 delete_page_cache( $post_url );113 delete_page_cache( $post_url, true ); 114 114 } 115 115 } -
powered-cache/trunk/includes/utils.php
r3038477 r3078450 891 891 * Delete cache file 892 892 * 893 * @param string $url Target URL 893 * @param string $url Target URL 894 * @param bool $delete_subdirectories Whether delete subdirectories or not 894 895 * 895 896 * @return bool true when found cache dir, otherwise false 896 897 * @since 1.0 897 898 */ 898 function delete_page_cache( $url ) { 899 899 function delete_page_cache( $url, $delete_subdirectories = false ) { 900 900 $dir = get_url_dir( trim( $url ) ); 901 901 … … 912 912 } 913 913 914 if ( file_exists( $dir ) && is_dir_empty( $dir) ) {914 if ( file_exists( $dir ) && ( $delete_subdirectories || is_dir_empty( $dir ) ) ) { 915 915 remove_dir( $dir ); 916 916 } -
powered-cache/trunk/languages/powered-cache.pot
r3074892 r3078450 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Powered Cache 3.4. 3\n"5 "Project-Id-Version: Powered Cache 3.4.4\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/powered-cache\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2024-04-2 2T09:13:19+00:00\n"12 "POT-Creation-Date: 2024-04-29T07:07:13+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.9.0\n" … … 1498 1498 msgstr "" 1499 1499 1500 #: includes/classes/AdvancedCache.php:10 41500 #: includes/classes/AdvancedCache.php:105 1501 1501 msgid "Purge Page Cache [Network Wide - All Sites]" 1502 1502 msgstr "" 1503 1503 1504 #: includes/classes/AdvancedCache.php:11 51504 #: includes/classes/AdvancedCache.php:116 1505 1505 msgid "Purge Page Cache" 1506 1506 msgstr "" 1507 1507 1508 #: includes/classes/AdvancedCache.php:12 51508 #: includes/classes/AdvancedCache.php:126 1509 1509 msgid "Purge Current Page" 1510 1510 msgstr "" -
powered-cache/trunk/powered-cache.php
r3074892 r3078450 4 4 * Plugin URI: https://poweredcache.com 5 5 * Description: Powered Cache is the most powerful caching and performance suite for WordPress, designed to easily improve your PageSpeed and Web Vitals Score. 6 * Version: 3.4. 36 * Version: 3.4.4 7 7 * Requires at least: 5.7 8 8 * Requires PHP: 7.2.5 … … 26 26 27 27 // Useful global constants. 28 define( 'POWERED_CACHE_VERSION', '3.4. 3' );28 define( 'POWERED_CACHE_VERSION', '3.4.4' ); 29 29 define( 'POWERED_CACHE_DB_VERSION', '3.4' ); 30 30 define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); -
powered-cache/trunk/readme.txt
r3074892 r3078450 4 4 Requires at least: 5.7 5 5 Tested up to: 6.5 6 Stable tag: 3.4. 36 Stable tag: 3.4.4 7 7 License: GPLv2 (or later) 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 171 171 172 172 == Changelog == 173 174 = 3.4.4 (April 29, 2024) = 175 - [Fixed] Resolved an issue with comment cache not purging correctly. 176 - [Added] Support for purging paginated comments. 173 177 174 178 = 3.4.3 (April 22, 2024) =
Note: See TracChangeset
for help on using the changeset viewer.