From d38d825e3484d822ea3c1f0fb1df37ecf386b18a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 04 Jan 2026 19:54:16 +0000
Subject: [PATCH] =TaxonomyCreator.js debugging
---
inc/managers/TaxonomyRelationships.php | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/inc/managers/TaxonomyRelationships.php b/inc/managers/TaxonomyRelationships.php
index c9cf044..2f466a7 100644
--- a/inc/managers/TaxonomyRelationships.php
+++ b/inc/managers/TaxonomyRelationships.php
@@ -4,6 +4,7 @@
use JVBase\JVB;
use JVBase\managers\CacheManager;
use WP_Error;
+use WP_Post;
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
@@ -19,7 +20,7 @@
{
global $wpdb;
$this->table_name = $wpdb->prefix . BASE.'taxonomy_relationships';
- $this->cache = new CacheManager('term_relationship', 86400);
+ $this->cache = CacheManager::for('term_relationship', WEEK_IN_SECONDS);
// Ensure the table exists
// $this->create_table_if_not_exists();
@@ -42,8 +43,8 @@
*/
public function init():void
{
- add_action('save_post', [$this, 'updatePostRelationships']);
- add_action('before_delete_post', [$this, 'updatePostRelationships']);
+ add_action('save_post', [$this, 'updatePostRelationships'], 10, 2);
+ add_action('before_delete_post', [$this, 'updatePostRelationships'], 10, 2);
add_action('delete_term', [$this, 'deleteTermRelationships']);
add_filter(BASE.'handle_bulk_operation', [$this, 'processOperation'], 10, 3);
@@ -57,13 +58,13 @@
*
* @return void
*/
- public function updatePostRelationships(int $post_id):void
+ public function updatePostRelationships(int $post_id, WP_Post $post):void
{
- $this->cache->invalidateGroup('term_relationships');
- $post_type = get_post_type($post_id);
- if (in_array($post_type, [BASE.'directory', BASE.'dash'])) {
+ $post_type = $post->post_type;
+ if (in_array($post_type, jvbIgnoredPostTypes())) {
return;
}
+ $this->cache->invalidate();
// Get all taxonomies for this post type
$taxonomies = get_object_taxonomies($post_type);
@@ -338,7 +339,7 @@
*/
public function rebuildAllRelationships():bool
{
- $this->cache->invalidateGroup('term_relationships');
+ $this->cache->invalidate();
global $wpdb;
// Clear existing relationships
@@ -370,7 +371,7 @@
]
);
- $this->cache->invalidateGroup('term_relationships');
+ $this->cache->invalidate();
return true;
}
@@ -448,6 +449,6 @@
$term_id,
$term_id
));
- $this->cache->invalidateGroup('term_relationships');
+ $this->cache->invalidate();
}
}
--
Gitblit v1.10.0