From 75a097a018a0090f5902758353c578fce4aa2a25 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sat, 23 May 2026 18:43:42 +0000
Subject: [PATCH] =CustomBlocks.php overhaul relatively complete. Also refactored the gallery in gallery.min.js and the jvbRenderGallery.
---
inc/managers/queue/TypeRegistry.php | 33 +++++++++++++++++++++++++++++++--
1 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/inc/managers/queue/TypeRegistry.php b/inc/managers/queue/TypeRegistry.php
index f695d75..9d5bf7b 100644
--- a/inc/managers/queue/TypeRegistry.php
+++ b/inc/managers/queue/TypeRegistry.php
@@ -3,6 +3,7 @@
if (!defined('ABSPATH')) {
exit;
}
+use JVBase\managers\queue\mergers\DefaultMerger;
final class TypeRegistry
{
@@ -10,6 +11,7 @@
public function register(string $type, TypeConfig $config): void
{
+ $this->validateRegistration($type, $config);
$this->configs[$type] = $config;
}
@@ -20,12 +22,27 @@
public function getExecutor(string $type): ?Executor
{
- return $this->configs[$type]?->executor;
+ return array_key_exists($type, $this->configs) ? $this->configs[$type]->executor : JVB()->queue()->executor;
}
public function getMergeable(string $type): ?Mergeable
{
- return $this->configs[$type]?->mergeable;
+ $config = $this->configs[$type] ?? null;
+ if (!$config) {
+ return null;
+ }
+
+ // Explicit mergeable always wins
+ if ($config->mergeable) {
+ return $config->mergeable;
+ }
+
+ // Default merge based on chunkKey
+ if ($config->chunkKey) {
+ return new DefaultMerger($config->chunkKey);
+ }
+
+ return null;
}
public function getConfig(string $type): ?TypeConfig
@@ -49,4 +66,16 @@
{
return $this->configs[$type]?->maxRetries ?? 3;
}
+
+ public function validateRegistration(string $type, TypeConfig $config): void
+ {
+ if ($config->executor && $config->chunkKey) {
+ // Verify executor can handle chunked operations
+ if (!method_exists($config->executor, 'execute')) {
+ throw new \InvalidArgumentException(
+ "Executor for '{$type}' must implement execute() method"
+ );
+ }
+ }
+ }
}
--
Gitblit v1.10.0