From 772462eeca3002a1d52508aeba485aab2b4742ad Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 03 Mar 2026 19:06:19 +0000
Subject: [PATCH] =MAJOR OVERHAUL. Likely should have made a new branch ages ago. Key changes: Registrar.php is the base for custom post types, taxonomies, and user roles. Replaces JVB_CONTENT, JVB_TAXONOMY, and JVB_USER constants, eliminates most of Features.php (except for JVB_SITE, JVB_MEMBERSHIP), and has built in sanitizing and validation via sub-classes. Also started a major overhaul of the Schema output. Created a shit ton of property traits and classes to help sanitize and ensure proper data for different schema types. Still a bunch to do, but better to be starting committing changes here on this other branch.
---
inc/managers/TaxonomyRelationships.php | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/inc/managers/TaxonomyRelationships.php b/inc/managers/TaxonomyRelationships.php
index 9ce35f5..2becd42 100644
--- a/inc/managers/TaxonomyRelationships.php
+++ b/inc/managers/TaxonomyRelationships.php
@@ -1,9 +1,9 @@
<?php
namespace JVBase\managers;
-use JVBase\JVB;
-use JVBase\managers\CacheManager;
+use JVBase\managers\Cache;
use WP_Error;
+use WP_Post;
if (!defined('ABSPATH')) {
exit; // Exit if accessed directly
@@ -19,7 +19,7 @@
{
global $wpdb;
$this->table_name = $wpdb->prefix . BASE.'taxonomy_relationships';
- $this->cache = CacheManager::for('term_relationship', WEEK_IN_SECONDS);
+ $this->cache = Cache::for('term_relationship', WEEK_IN_SECONDS);
// Ensure the table exists
// $this->create_table_if_not_exists();
@@ -42,8 +42,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,11 +57,10 @@
*
* @return void
*/
- public function updatePostRelationships(int $post_id):void
+ public function updatePostRelationships(int $post_id, WP_Post $post):void
{
- $this->cache->invalidate();
- $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;
}
// Get all taxonomies for this post type
@@ -338,7 +337,7 @@
*/
public function rebuildAllRelationships():bool
{
- $this->cache->invalidate();
+ $this->cache->flush();
global $wpdb;
// Clear existing relationships
@@ -370,7 +369,7 @@
]
);
- $this->cache->invalidate();
+ $this->cache->flush();
return true;
}
@@ -448,6 +447,5 @@
$term_id,
$term_id
));
- $this->cache->invalidate();
}
}
--
Gitblit v1.10.0