From 3d25ad7de4fdbb3eba2cde2a62422e6be5d79a0a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 25 Aug 2026 22:57:22 +0000
Subject: [PATCH] =It's been a minute. I went through the Routes and associated Managers and ensured they played together well. Reworked the Cache.php, and I think I caught all the references. Moving away from JVBase() root class, to individuall classes that are Instanced. Double checked for the ABSPATH check in every file, and added index.php to every directory that didn't already have it. Also still working on the MenuBlock to work with WooCommerce for now for Northeh
---
inc/managers/queue/executors/ContentTermExecutor.php | 59 +++++++++++++++++++++++++++++------------------------------
1 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/inc/managers/queue/executors/ContentTermExecutor.php b/inc/managers/queue/executors/ContentTermExecutor.php
index bac1179..010b5fe 100644
--- a/inc/managers/queue/executors/ContentTermExecutor.php
+++ b/inc/managers/queue/executors/ContentTermExecutor.php
@@ -6,9 +6,9 @@
use JVBase\managers\queue\Operation;
use JVBase\managers\queue\Progress;
use JVBase\managers\queue\Result;
-use JVBase\managers\RoleManager;
+use JVBase\managers\Roles;
use JVBase\meta\Meta;
-use JVBase\utility\Features;
+use JVBase\registrar\Registrar;
use Exception;
if (!defined('ABSPATH')) {
@@ -25,20 +25,21 @@
*/
class ContentTermExecutor implements Executor
{
- protected RoleManager $roleManager;
+ protected Roles $roleManager;
public function __construct()
{
- $this->roleManager = new RoleManager();
+ $this->roleManager = new Roles();
}
public function execute(Operation $operation, Progress $progress): Result
{
+ error_log('Executing Content Term.... ');
// Extract taxonomy from operation type (e.g., "shop_update" -> "shop")
- $parts = explode('_', $operation->type);
- $taxonomy = $parts[0] ?? '';
-
- if (!$taxonomy || !isset(JVB_TAXONOMY[$taxonomy])) {
+ $data= $operation->requestData;
+ $taxonomy = $data['taxonomy']??false;
+ $registrar = $taxonomy? Registrar::getInstance($taxonomy) : false;
+ if (!$taxonomy || !$registrar) {
return Result::fail("Invalid taxonomy: {$taxonomy}");
}
@@ -73,7 +74,7 @@
unset($data['term_id']);
// Filter to only allowed fields
- $allowed = jvbGetFields($taxonomy, 'term');
+ $allowed = Registrar::getFieldsFor($taxonomy);
$setData = array_filter(
$data,
fn($key) => array_key_exists($key, $allowed),
@@ -85,13 +86,9 @@
}
// Update metadata
- $meta->setAll($setData);
- $results = $meta->save();
+ $results = $meta->setAll($setData);
if ($results) {
- // Trigger any post-update actions (e.g., thumbnail generation)
- do_action(BASE . "{$taxonomy}_updated", $termID, $userID, $setData);
-
return Result::success([
'updated_fields' => array_keys($setData),
'term_id' => $termID
@@ -128,7 +125,8 @@
}
// Check if tracking enabled
- if (!Features::forTaxonomy($taxonomy)->has('track_changes')) {
+ $registrar = Registrar::getInstance($taxonomy);
+ if ($registrar && !$registrar->hasFeature('track_changes')) {
return Result::fail('Member tracking not enabled for ' . $taxonomy);
}
@@ -173,15 +171,18 @@
*/
protected function addMember(int $userID, int $termID, string $taxonomy): Result
{
- $config = JVB_TAXONOMY[$taxonomy] ?? [];
- $content = $config['for_content'] ?? [];
+ $registrar = Registrar::getInstance($taxonomy);
+ if (!$registrar) {
+ return Result::fail('No content registered');
+ }
- if (empty($content)) {
+ $forContent = $registrar->registrar->for;
+ if (empty($forContent)) {
return Result::fail('No content types configured for ' . $taxonomy);
}
// Get table name (e.g., "history_artist_shop")
- $contentType = $content[0]; // Use first content type
+ $contentType = is_array($forContent) ? $forContent[0] : $forContent; // Use first content type
$tableName = "history_{$contentType}_{$taxonomy}";
$table = CustomTable::for($tableName);
@@ -235,9 +236,6 @@
throw new Exception('Failed to set taxonomy term: ' . $termResult->get_error_message());
}
- // Clear cache
- JVB()->cache()->for($taxonomy)->delete("{$taxonomy}_{$termID}_members");
-
// Notify term managers
$this->notifyTermManagers($termID, $userID, $taxonomy, 'member_added');
@@ -254,15 +252,19 @@
*/
protected function removeMember(int $userID, int $termID, string $taxonomy): Result
{
- $config = JVB_TAXONOMY[$taxonomy] ?? [];
- $content = $config['for_content'] ?? [];
+ $registrar = Registrar::getInstance($taxonomy);
+ if (!$registrar) {
+ return Result::fail('No content registered');
+ }
+ $forContent = $registrar->registrar->for;
- if (empty($content)) {
+ if (empty($forContent)) {
return Result::fail('No content types configured for ' . $taxonomy);
}
// Get table name
- $contentType = $content[0];
+ $contentType = is_array($forContent) ? $forContent[0] : $forContent;
+
$tableName = "history_{$contentType}_{$taxonomy}";
$table = CustomTable::for($tableName);
@@ -296,9 +298,6 @@
throw new Exception('Failed to remove taxonomy term: ' . $termResult->get_error_message());
}
- // Clear cache
- JVB()->cache()->for($taxonomy)->delete("{$taxonomy}_{$termID}_members");
-
// Notify term managers
$this->notifyTermManagers($termID, $userID, $taxonomy, 'member_removed');
@@ -320,7 +319,7 @@
$user = get_userdata($userID);
foreach ($managers as $managerID) {
- JVB()->notification()->addNotification(
+ NotificationManager::getInstance()->addNotification(
$managerID,
$notificationType,
[
--
Gitblit v1.10.0