Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix: Prevent PHP fatal error when trying to delete a term #2650

Merged
merged 3 commits into from May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions inc/Engine/Cache/PurgeActionsSubscriber.php
Expand Up @@ -31,11 +31,11 @@ public function __construct( Options_Data $options ) {
*/
public static function get_subscribed_events() {
return [
'profile_update' => 'purge_user_cache',
'delete_user' => 'purge_user_cache',
'create_term' => [ 'maybe_purge_cache_on_term_change', 10, 3 ],
'edit_term' => [ 'maybe_purge_cache_on_term_change', 10, 3 ],
'pre_delete_term' => [ 'maybe_purge_cache_on_term_change', 10, 3 ],
'profile_update' => 'purge_user_cache',
'delete_user' => 'purge_user_cache',
'create_term' => [ 'maybe_purge_cache_on_term_change', 10, 3 ],
'edit_term' => [ 'maybe_purge_cache_on_term_change', 10, 3 ],
'delete_term' => [ 'maybe_purge_cache_on_term_change', 10, 3 ],
];
}

Expand Down
Expand Up @@ -15,7 +15,7 @@
'action' => 'edit_term',
],
'testDeleteTerm' => [
'action' => 'pre_delete_term',
'action' => 'delete_term',
],
],
'unit_test_data' => [
Expand Down
Expand Up @@ -44,7 +44,7 @@ public static function wpSetUpBeforeClass( $factory ) {
public function testShouldNotPurgeCacheWhenTaxonomyNotPublic() {
do_action( 'create_term', self::$not_public_term->term_id, self::$not_public_term->term_taxonomy_id, self::$not_public_term->taxonomy );
do_action( 'edit_term', self::$not_public_term->term_id, self::$not_public_term->term_taxonomy_id, self::$not_public_term->taxonomy );
do_action( 'pre_delete_term', self::$not_public_term->term_id, self::$not_public_term->term_taxonomy_id, self::$not_public_term->taxonomy );
do_action( 'delete_term', self::$not_public_term->term_id, self::$not_public_term->term_taxonomy_id, self::$not_public_term->taxonomy );

// Check no files were deleted.
foreach( $this->original_files as $file ) {
Expand Down