From 18e7e415339ccc9adf8ade562f93abef606da16d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 26 Aug 2026 22:24:18 +0000
Subject: [PATCH] =Cache::connects throughout codebase refactored
---
checks.php | 37 ++++++++++++++++++++-----------------
1 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/checks.php b/checks.php
index 79cc829..4339047 100644
--- a/checks.php
+++ b/checks.php
@@ -25,11 +25,10 @@
if (!Site::has('limit_hours')) {
return true;
}
- if (Options::get('open_to_public') !== 1) {
- error_log('Not open to public');
+ if (Options::get('open_to_public') !== '1') {
return false;
}
- if (Options::get('today_hours')) {
+ if (!empty(Options::get('today_hours'))) {
return jvbIsTimeBetween();
}
return jvbIsCurrentlyOpen();
@@ -38,26 +37,30 @@
function jvbTermHasPosts(int $termID, string $taxonomy):bool
{
- $cache = Cache::for('termUtility', 30*60)->connect('taxonomy');
+ $cache = Cache::for('termUtility', 'term', 30*60);
return $cache->remember(
$termID,
function() use($taxonomy, $termID) {
$taxonomy = jvbCheckBase($taxonomy);
$tax = get_taxonomy($taxonomy);
- $query = new WP_Query([
- 'post_type' => $tax->object_type,
- 'posts_per_page' => 1,
- 'fields' => 'ids',
- 'tax_query' => [
- [
- 'taxonomy' => $taxonomy,
- 'terms' => $termID
+ if ($tax) {
+ $query = new WP_Query([
+ 'post_type' => $tax->object_type,
+ 'posts_per_page' => 1,
+ 'fields' => 'ids',
+ 'tax_query' => [
+ [
+ 'taxonomy' => $taxonomy,
+ 'terms' => $termID
+ ]
]
- ]
- ]);
- $result = ($query->have_posts()) ? 'true' : 'false';
- wp_reset_postdata();
- return $result;
+ ]);
+ $result = ($query->have_posts()) ? 'true' : 'false';
+ wp_reset_postdata();
+ return $result;
+
+ }
+ return 'false';
}
);
}
--
Gitblit v1.10.0