From 3e4e3db64b366028845cfd610c5b17f26bd062ee Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 06 Sep 2026 23:04:45 +0000
Subject: [PATCH] =Added conditional logic. Skeletoned a block to select a particular meta for display.
---
inc/managers/NewsRelationships.php | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/inc/managers/NewsRelationships.php b/inc/managers/NewsRelationships.php
index 526ea30..5d12beb 100644
--- a/inc/managers/NewsRelationships.php
+++ b/inc/managers/NewsRelationships.php
@@ -1,7 +1,7 @@
<?php
namespace JVBase\managers;
-use JVBase\JVB;
+use JVBase\managers\queue\Queue;
use WP_Post;
use WP_Term;
use WP_Query;
@@ -15,14 +15,13 @@
*/
class NewsRelationships
{
- private string $table_name;
- private CacheManager $cache;
+ protected Cache $cache;
public function __construct()
{
global $wpdb;
$this->table_name = $wpdb->prefix . BASE . 'news_relationships';
- $this->cache = CacheManager::for('news_relationships', WEEK_IN_SECONDS);
+ $this->cache = Cache::for('news_relationships', WEEK_IN_SECONDS)->connect('post', true)->connect('taxonomy', true)->connect('user',true);
// Register hooks
add_action('init', [$this, 'registerHooks']);
@@ -215,7 +214,7 @@
*/
public function handleLinkChange(int $meta_id, int $object_id, string $meta_key, string|null $meta_value = null):void
{
- // Only proceed for BASE.'link' meta key
+ // Only proceed for BASE.'profile_link' meta key
if ($meta_key !== BASE . 'link') {
return;
}
@@ -367,7 +366,7 @@
* Get all artists with news post counts
* @return array
*/
- public function getAllArtistsWithNews():int
+ public function getAllArtistsWithNews():array
{
global $wpdb;
@@ -512,7 +511,7 @@
}
// Update cache
- $this->cache->delete($shop_id);
+ $this->cache->forget($shop_id);
// Update shop total count
$this->updateShopTotal($shop_id);
@@ -534,7 +533,7 @@
);
// Update cache
- $this->cache->delete($shop_id);
+ $this->cache->forget($shop_id);
}
/**
@@ -626,7 +625,7 @@
$wpdb->query("TRUNCATE TABLE {$this->table_name}");
- JVB()->queue()->queueOperation(
+ Queue::getInstance()->queueOperation(
'rebuild_news',
0,
[
@@ -645,7 +644,7 @@
}
/**
- * @param WP_Error $result
+ * @param WP_Error|array $result
* @param object $operation
* @param array $data
*
--
Gitblit v1.10.0