Changeset 3038477
- Timestamp:
- 02/20/2024 12:32:07 PM (2 years ago)
- Location:
- powered-cache
- Files:
-
- 2 added
- 12 edited
- 1 copied
-
tags/3.4.2 (copied) (copied from powered-cache/trunk)
-
tags/3.4.2/includes/classes/AdvancedCache.php (modified) (2 diffs)
-
tags/3.4.2/includes/compat/loader.php (modified) (1 diff)
-
tags/3.4.2/includes/compat/plugins/short-pixel-ai.php (added)
-
tags/3.4.2/includes/utils.php (modified) (4 diffs)
-
tags/3.4.2/languages/powered-cache.pot (modified) (4 diffs)
-
tags/3.4.2/powered-cache.php (modified) (2 diffs)
-
tags/3.4.2/readme.txt (modified) (2 diffs)
-
trunk/includes/classes/AdvancedCache.php (modified) (2 diffs)
-
trunk/includes/compat/loader.php (modified) (1 diff)
-
trunk/includes/compat/plugins/short-pixel-ai.php (added)
-
trunk/includes/utils.php (modified) (4 diffs)
-
trunk/languages/powered-cache.pot (modified) (4 diffs)
-
trunk/powered-cache.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
powered-cache/tags/3.4.2/includes/classes/AdvancedCache.php
r3032658 r3038477 85 85 add_filter( 'powered_cache_mod_rewrite', array( $this, 'maybe_disable_mod_rewrite' ), 99 ); 86 86 add_action( 'wp_update_site', array( $this, 'purge_on_site_update' ), 10, 2 ); 87 add_action( 'create_term', array( $this, 'purge_on_term_change' ), 10, 3 ); 88 add_action( 'edit_term', array( $this, 'purge_on_term_change' ), 10, 3 ); 89 add_action( 'delete_term', array( $this, 'purge_on_term_change' ), 10, 3 ); 87 90 } 88 91 … … 672 675 673 676 677 /** 678 * Purge cache when term change 679 * 680 * @param int $term_id Term ID 681 * @param int $tt_id Term Taxonomy ID 682 * @param string $taxonomy Taxonomy 683 * 684 * @since 3.4.2 685 */ 686 public function purge_on_term_change( $term_id, $tt_id, $taxonomy ) { 687 $term_taxonomy = get_taxonomy( $taxonomy ); 688 689 if ( ! $term_taxonomy->public ) { 690 return; 691 } 692 693 $term_url = get_term_link( $term_id, $taxonomy ); 694 695 if ( ! is_wp_error( $term_url ) ) { 696 if ( $this->settings['async_cache_cleaning'] ) { 697 $this->cache_purger->push_to_queue( 698 [ 699 'call' => 'delete_page_cache', 700 'urls' => $term_url, 701 ] 702 ); 703 $this->cache_purger->save()->dispatch(); 704 } else { 705 delete_page_cache( $term_url ); 706 } 707 } 708 } 674 709 675 710 } -
powered-cache/tags/3.4.2/includes/compat/loader.php
r3016660 r3038477 40 40 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/phastpress.php'; 41 41 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/wps-hide-login.php'; 42 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/short-pixel-ai.php'; 42 43 43 44 require_once POWERED_CACHE_COMPAT_DIR . 'themes/bricks.php'; -
powered-cache/tags/3.4.2/includes/utils.php
r3032658 r3038477 721 721 $valid_post_statuses = [ 'publish', 'private', 'trash', 'pending', 'draft' ]; 722 722 $post_status = get_post_status( $post_id ); 723 $post = get_post( $post_id ); 723 724 724 725 // Post types that should not have their cache purged. … … 736 737 if ( $rest_api_route ) { 737 738 $post_type_object = get_post_type_object( $post_type ); 738 if ( isset( $post_type_object->rest_base ) ) { 739 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_object->rest_base . '/' . $post_id . '/'; 739 if ( ! empty( $post_type_object->show_in_rest ) ) { 740 $post_type_base = $post_type_object->rest_base ? $post_type_object->rest_base : $post_type_object->name; 741 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_base . '/' . $post_id . '/'; 740 742 } elseif ( in_array( $post_type, [ 'post', 'page' ], true ) ) { 741 743 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type . 's/' . $post_id . '/'; … … 761 763 } 762 764 763 // Purge categories and tags associated with the post. 764 $categories = get_the_category( $post_id ); 765 foreach ( $categories as $category ) { 766 $related_urls[] = get_category_link( $category->term_id ); 767 if ( $rest_api_route ) { 768 $related_urls[] = get_rest_url() . $rest_api_route . '/categories/' . $category->term_id . '/'; 765 $taxonomies = get_object_taxonomies( get_post_type( $post_id ), 'objects' ); 766 767 // Purge terms associated with the post. 768 foreach ( $taxonomies as $taxonomy ) { 769 // Skip non-public taxonomies. 770 if ( ! $taxonomy->public ) { 771 continue; 769 772 } 770 } 771 772 $tags = get_the_tags( $post_id ); 773 if ( $tags ) { 774 foreach ( $tags as $tag ) { 775 $related_urls[] = get_tag_link( $tag->term_id ); 776 if ( $rest_api_route ) { 777 $related_urls[] = get_rest_url() . $rest_api_route . '/tags/' . $tag->term_id . '/'; 773 774 $terms = get_the_terms( $post_id, $taxonomy->name ); 775 776 if ( empty( $terms ) || is_wp_error( $terms ) ) { 777 continue; 778 } 779 780 foreach ( $terms as $term ) { 781 $term_url = get_term_link( $term->slug, $taxonomy->name ); 782 if ( ! is_wp_error( $term_url ) ) { 783 $related_urls[] = $term_url; 784 if ( $taxonomy->show_in_rest ) { 785 $taxonomy_base = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name; 786 $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$term->term_id}/" ); // REST API URL for the term 787 } 788 } 789 790 if ( ! is_taxonomy_hierarchical( $taxonomy->name ) ) { 791 continue; 792 } 793 794 $ancestors = (array) get_ancestors( $term->term_id, $taxonomy->name ); 795 foreach ( $ancestors as $ancestor ) { 796 $ancestor_object = get_term( $ancestor, $taxonomy->name ); 797 if ( ! is_a( $ancestor, '\WP_Term' ) ) { 798 continue; 799 } 800 801 $ancestor_term_url = get_term_link( $ancestor_object->slug, $taxonomy->name ); 802 if ( ! is_wp_error( $ancestor_term_url ) ) { 803 $related_urls[] = $ancestor_term_url; 804 if ( $taxonomy->show_in_rest ) { 805 $taxonomy_base = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name; 806 $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$ancestor_object->term_id}/" ); // REST API URL for the ancestor term 807 } 808 } 778 809 } 779 810 } … … 805 836 $related_urls[] = get_post_type_archive_link( $post_type ); 806 837 $related_urls[] = get_post_type_archive_feed_link( $post_type ); 838 } 839 840 $post_date = strtotime( $post->post_date ); 841 842 if ( $post_date ) { 843 // Generate the date archive URLs 844 $year = gmdate( 'Y', $post_date ); 845 $month = gmdate( 'm', $post_date ); 846 $day = gmdate( 'd', $post_date ); 847 848 $related_urls[] = get_year_link( $year ); 849 $related_urls[] = get_month_link( $year, $month ); 850 $related_urls[] = get_day_link( $year, $month, $day ); 807 851 } 808 852 -
powered-cache/tags/3.4.2/languages/powered-cache.pot
r3035081 r3038477 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Powered Cache 3.4. 1\n"5 "Project-Id-Version: Powered Cache 3.4.2\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-02- 13T12:04:39+00:00\n"12 "POT-Creation-Date: 2024-02-20T12:29:16+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" … … 1495 1495 msgstr "" 1496 1496 1497 #: includes/classes/AdvancedCache.php:10 11497 #: includes/classes/AdvancedCache.php:104 1498 1498 msgid "Purge Page Cache [Network Wide - All Sites]" 1499 1499 msgstr "" 1500 1500 1501 #: includes/classes/AdvancedCache.php:11 21501 #: includes/classes/AdvancedCache.php:115 1502 1502 msgid "Purge Page Cache" 1503 1503 msgstr "" 1504 1504 1505 #: includes/classes/AdvancedCache.php:12 21505 #: includes/classes/AdvancedCache.php:125 1506 1506 msgid "Purge Current Page" 1507 1507 msgstr "" … … 1586 1586 1587 1587 #. translators: %1$s plugin name, %2$s conflicted feature name (Eg lazyload) 1588 #: includes/compat/loader.php:6 71588 #: includes/compat/loader.php:68 1589 1589 msgid "It seems %1$s is activated on your site. Powered Cache works perfectly fine with %1$s but you cannot use %2$s functionalities that conflic with %1$s plugin unless you deactivate it." 1590 1590 msgstr "" -
powered-cache/tags/3.4.2/powered-cache.php
r3035081 r3038477 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. 16 * Version: 3.4.2 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. 1' );28 define( 'POWERED_CACHE_VERSION', '3.4.2' ); 29 29 define( 'POWERED_CACHE_DB_VERSION', '3.4' ); 30 30 define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); -
powered-cache/tags/3.4.2/readme.txt
r3035081 r3038477 4 4 Requires at least: 5.7 5 5 Tested up to: 6.4 6 Stable tag: 3.4. 16 Stable tag: 3.4.2 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.2 (February 20, 2024) = 175 - [Added] Term cache clearing upon term changes. 176 - [Added] Compatibility with ShortPixel Adaptive Images when delay JS is enabled. 177 - [Added] Date archive cache clearing upon post updates. 178 - [Improved] Term archive purging upon post updates. 173 179 174 180 = 3.4.1 (February 13, 2024) = -
powered-cache/trunk/includes/classes/AdvancedCache.php
r3032658 r3038477 85 85 add_filter( 'powered_cache_mod_rewrite', array( $this, 'maybe_disable_mod_rewrite' ), 99 ); 86 86 add_action( 'wp_update_site', array( $this, 'purge_on_site_update' ), 10, 2 ); 87 add_action( 'create_term', array( $this, 'purge_on_term_change' ), 10, 3 ); 88 add_action( 'edit_term', array( $this, 'purge_on_term_change' ), 10, 3 ); 89 add_action( 'delete_term', array( $this, 'purge_on_term_change' ), 10, 3 ); 87 90 } 88 91 … … 672 675 673 676 677 /** 678 * Purge cache when term change 679 * 680 * @param int $term_id Term ID 681 * @param int $tt_id Term Taxonomy ID 682 * @param string $taxonomy Taxonomy 683 * 684 * @since 3.4.2 685 */ 686 public function purge_on_term_change( $term_id, $tt_id, $taxonomy ) { 687 $term_taxonomy = get_taxonomy( $taxonomy ); 688 689 if ( ! $term_taxonomy->public ) { 690 return; 691 } 692 693 $term_url = get_term_link( $term_id, $taxonomy ); 694 695 if ( ! is_wp_error( $term_url ) ) { 696 if ( $this->settings['async_cache_cleaning'] ) { 697 $this->cache_purger->push_to_queue( 698 [ 699 'call' => 'delete_page_cache', 700 'urls' => $term_url, 701 ] 702 ); 703 $this->cache_purger->save()->dispatch(); 704 } else { 705 delete_page_cache( $term_url ); 706 } 707 } 708 } 674 709 675 710 } -
powered-cache/trunk/includes/compat/loader.php
r3016660 r3038477 40 40 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/phastpress.php'; 41 41 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/wps-hide-login.php'; 42 require_once POWERED_CACHE_COMPAT_DIR . 'plugins/short-pixel-ai.php'; 42 43 43 44 require_once POWERED_CACHE_COMPAT_DIR . 'themes/bricks.php'; -
powered-cache/trunk/includes/utils.php
r3032658 r3038477 721 721 $valid_post_statuses = [ 'publish', 'private', 'trash', 'pending', 'draft' ]; 722 722 $post_status = get_post_status( $post_id ); 723 $post = get_post( $post_id ); 723 724 724 725 // Post types that should not have their cache purged. … … 736 737 if ( $rest_api_route ) { 737 738 $post_type_object = get_post_type_object( $post_type ); 738 if ( isset( $post_type_object->rest_base ) ) { 739 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_object->rest_base . '/' . $post_id . '/'; 739 if ( ! empty( $post_type_object->show_in_rest ) ) { 740 $post_type_base = $post_type_object->rest_base ? $post_type_object->rest_base : $post_type_object->name; 741 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type_base . '/' . $post_id . '/'; 740 742 } elseif ( in_array( $post_type, [ 'post', 'page' ], true ) ) { 741 743 $related_urls[] = get_rest_url() . $rest_api_route . '/' . $post_type . 's/' . $post_id . '/'; … … 761 763 } 762 764 763 // Purge categories and tags associated with the post. 764 $categories = get_the_category( $post_id ); 765 foreach ( $categories as $category ) { 766 $related_urls[] = get_category_link( $category->term_id ); 767 if ( $rest_api_route ) { 768 $related_urls[] = get_rest_url() . $rest_api_route . '/categories/' . $category->term_id . '/'; 765 $taxonomies = get_object_taxonomies( get_post_type( $post_id ), 'objects' ); 766 767 // Purge terms associated with the post. 768 foreach ( $taxonomies as $taxonomy ) { 769 // Skip non-public taxonomies. 770 if ( ! $taxonomy->public ) { 771 continue; 769 772 } 770 } 771 772 $tags = get_the_tags( $post_id ); 773 if ( $tags ) { 774 foreach ( $tags as $tag ) { 775 $related_urls[] = get_tag_link( $tag->term_id ); 776 if ( $rest_api_route ) { 777 $related_urls[] = get_rest_url() . $rest_api_route . '/tags/' . $tag->term_id . '/'; 773 774 $terms = get_the_terms( $post_id, $taxonomy->name ); 775 776 if ( empty( $terms ) || is_wp_error( $terms ) ) { 777 continue; 778 } 779 780 foreach ( $terms as $term ) { 781 $term_url = get_term_link( $term->slug, $taxonomy->name ); 782 if ( ! is_wp_error( $term_url ) ) { 783 $related_urls[] = $term_url; 784 if ( $taxonomy->show_in_rest ) { 785 $taxonomy_base = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name; 786 $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$term->term_id}/" ); // REST API URL for the term 787 } 788 } 789 790 if ( ! is_taxonomy_hierarchical( $taxonomy->name ) ) { 791 continue; 792 } 793 794 $ancestors = (array) get_ancestors( $term->term_id, $taxonomy->name ); 795 foreach ( $ancestors as $ancestor ) { 796 $ancestor_object = get_term( $ancestor, $taxonomy->name ); 797 if ( ! is_a( $ancestor, '\WP_Term' ) ) { 798 continue; 799 } 800 801 $ancestor_term_url = get_term_link( $ancestor_object->slug, $taxonomy->name ); 802 if ( ! is_wp_error( $ancestor_term_url ) ) { 803 $related_urls[] = $ancestor_term_url; 804 if ( $taxonomy->show_in_rest ) { 805 $taxonomy_base = $taxonomy->rest_base ? $taxonomy->rest_base : $taxonomy->name; 806 $related_urls[] = rest_url( "{$taxonomy->rest_namespace}/{$taxonomy_base}/{$ancestor_object->term_id}/" ); // REST API URL for the ancestor term 807 } 808 } 778 809 } 779 810 } … … 805 836 $related_urls[] = get_post_type_archive_link( $post_type ); 806 837 $related_urls[] = get_post_type_archive_feed_link( $post_type ); 838 } 839 840 $post_date = strtotime( $post->post_date ); 841 842 if ( $post_date ) { 843 // Generate the date archive URLs 844 $year = gmdate( 'Y', $post_date ); 845 $month = gmdate( 'm', $post_date ); 846 $day = gmdate( 'd', $post_date ); 847 848 $related_urls[] = get_year_link( $year ); 849 $related_urls[] = get_month_link( $year, $month ); 850 $related_urls[] = get_day_link( $year, $month, $day ); 807 851 } 808 852 -
powered-cache/trunk/languages/powered-cache.pot
r3035081 r3038477 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Powered Cache 3.4. 1\n"5 "Project-Id-Version: Powered Cache 3.4.2\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-02- 13T12:04:39+00:00\n"12 "POT-Creation-Date: 2024-02-20T12:29:16+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" … … 1495 1495 msgstr "" 1496 1496 1497 #: includes/classes/AdvancedCache.php:10 11497 #: includes/classes/AdvancedCache.php:104 1498 1498 msgid "Purge Page Cache [Network Wide - All Sites]" 1499 1499 msgstr "" 1500 1500 1501 #: includes/classes/AdvancedCache.php:11 21501 #: includes/classes/AdvancedCache.php:115 1502 1502 msgid "Purge Page Cache" 1503 1503 msgstr "" 1504 1504 1505 #: includes/classes/AdvancedCache.php:12 21505 #: includes/classes/AdvancedCache.php:125 1506 1506 msgid "Purge Current Page" 1507 1507 msgstr "" … … 1586 1586 1587 1587 #. translators: %1$s plugin name, %2$s conflicted feature name (Eg lazyload) 1588 #: includes/compat/loader.php:6 71588 #: includes/compat/loader.php:68 1589 1589 msgid "It seems %1$s is activated on your site. Powered Cache works perfectly fine with %1$s but you cannot use %2$s functionalities that conflic with %1$s plugin unless you deactivate it." 1590 1590 msgstr "" -
powered-cache/trunk/powered-cache.php
r3035081 r3038477 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. 16 * Version: 3.4.2 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. 1' );28 define( 'POWERED_CACHE_VERSION', '3.4.2' ); 29 29 define( 'POWERED_CACHE_DB_VERSION', '3.4' ); 30 30 define( 'POWERED_CACHE_PLUGIN_FILE', __FILE__ ); -
powered-cache/trunk/readme.txt
r3035081 r3038477 4 4 Requires at least: 5.7 5 5 Tested up to: 6.4 6 Stable tag: 3.4. 16 Stable tag: 3.4.2 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.2 (February 20, 2024) = 175 - [Added] Term cache clearing upon term changes. 176 - [Added] Compatibility with ShortPixel Adaptive Images when delay JS is enabled. 177 - [Added] Date archive cache clearing upon post updates. 178 - [Improved] Term archive purging upon post updates. 173 179 174 180 = 3.4.1 (February 13, 2024) =
Note: See TracChangeset
for help on using the changeset viewer.