From 2127b1bdd73ecd2423e443992da4b442f5a3c1a3 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 04 Feb 2026 21:19:25 +0000
Subject: [PATCH] =Major overhaul of MetaManager.php -> Meta.php and RestRouteManager.php -> Rest.php. Seems to work for JakeVan

---
 inc/managers/queue/executors/UploadExecutor.php |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/inc/managers/queue/executors/UploadExecutor.php b/inc/managers/queue/executors/UploadExecutor.php
index ab2f992..c92fee3 100644
--- a/inc/managers/queue/executors/UploadExecutor.php
+++ b/inc/managers/queue/executors/UploadExecutor.php
@@ -3,7 +3,7 @@
 
 use JVBase\managers\queue\{Executor, Operation, Progress, Result};
 use JVBase\managers\UploadManager;
-use JVBase\meta\MetaManager;
+use JVBase\meta\Meta;
 use Exception;
 use JVBase\utility\Features;
 
@@ -366,11 +366,11 @@
 				}
 
 				if (!empty($gallery_attachment_ids)) {
-					$meta = new MetaManager($newPostID, 'post');
+					$meta = Meta::forPost($newPostID);
 					$fields = jvbGetFields($content, 'post');
 					foreach($fields as $name => $config) {
 						if ($config['type'] === 'gallery') {
-							$meta->updateValue($name, implode(',', $gallery_attachment_ids));
+							$meta->set($name, implode(',', $gallery_attachment_ids));
 							break;
 						}
 					}
@@ -542,11 +542,11 @@
 			return;
 		}
 
-		$existing = $meta->getValue($data['field_name']);
+		$existing = $meta->get($data['field_name']);
 		$existingIds = !empty($existing) ? explode(',', $existing) : [];
 		$allIds = array_unique(array_merge($existingIds, $attachmentIds));
 
-		$meta->updateValue($data['field_name'], implode(',', $allIds));
+		$meta->set($data['field_name'], implode(',', $allIds));
 	}
 
 	private function updateFieldValue(array $data, array $results): void
@@ -561,25 +561,25 @@
 			return;
 		}
 
-		$existing = $meta->getValue($data['field_name']);
+		$existing = $meta->get($data['field_name']);
 		$existingIds = !empty($existing) ? explode(',', $existing) : [];
 		$allIds = array_unique(array_merge($existingIds, $attachmentIds));
 
-		$meta->updateValue($data['field_name'], implode(',', $allIds));
+		$meta->set($data['field_name'], implode(',', $allIds));
 	}
 
-	private function getMetaManager(array $data): ?MetaManager
+	private function getMetaManager(array $data): ?Meta
 	{
 		if (!empty($data['post_id'])) {
-			return new MetaManager($data['post_id'], 'post');
+			return Meta::forPost($data['post_id']);
 		}
 		if (!empty($data['term_id'])) {
-			return new MetaManager($data['term_id'], 'term');
+			return Meta::forTerm($data['term_id']);
 		}
 		if (!empty($data['user'])) {
 			$link = (int)get_user_meta($data['user'], BASE . 'link', true);
 			if ($link) {
-				return new MetaManager($link, 'post');
+				return Meta::forPost($link);
 			}
 		}
 		return null;
@@ -626,14 +626,14 @@
 		if (str_starts_with($mimeType, 'image/')) {
 			set_post_thumbnail($postId, $attachmentId);
 		} elseif (str_starts_with($mimeType, 'video/')) {
-			$meta = new MetaManager($postId, 'post');
-			$meta->updateValue('video', $attachmentId);
+			$meta = Meta::forPost($postId);
+			$meta->set('video', $attachmentId);
 		} else {
-			$meta = new MetaManager($postId, 'post');
-			$existing = $meta->getValue('documents');
+			$meta = Meta::forPost($postId);
+			$existing = $meta->get('documents');
 			$existingIds = !empty($existing) ? explode(',', $existing) : [];
 			$existingIds[] = $attachmentId;
-			$meta->updateValue('documents', implode(',', $existingIds));
+			$meta->set('documents', implode(',', $existingIds));
 		}
 	}
 

--
Gitblit v1.10.0