From b38f03c0e7218762d90fa5092696b127f24f36db Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sun, 25 Jan 2026 07:07:26 +0000
Subject: [PATCH] =Some logical flaws in Queue.php, Queue.js, ContentExecutor.php, UploadExecutor.php - particularly with timeline ordering, frontend queue updates, etc
---
inc/managers/queue/executors/UploadExecutor.php | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/inc/managers/queue/executors/UploadExecutor.php b/inc/managers/queue/executors/UploadExecutor.php
index c71e680..7461cfd 100644
--- a/inc/managers/queue/executors/UploadExecutor.php
+++ b/inc/managers/queue/executors/UploadExecutor.php
@@ -385,6 +385,7 @@
$defaultTitle = 'New '.$config['singular']. ' ';
foreach($data['posts'] as $index => $post) {
+ $progress->advance();
$title = array_key_exists('post_title', $post['fields'])
? sanitize_text_field($post['fields']['post_title'])
: $defaultTitle . ($index + 1);
@@ -405,6 +406,7 @@
$parent = wp_insert_post($args);
$progress->advance();
if ($parent && !is_wp_error($parent)) {
+
$childPosts = [];
$featured = $post['fields']['featured']??null;
$featuredID = null;
@@ -442,6 +444,8 @@
}
}
}
+
+ $this->updateTimelineMetadata($parent);
}
}
return new Result(
@@ -450,6 +454,30 @@
);
}
+ /**
+ * Update timeline parent post with count and latest date
+ * @param int $parentId Parent timeline post ID
+ */
+ private function updateTimelineMetadata(int $parentId): void
+ {
+ // Get all child posts
+ $children = get_children([
+ 'post_parent' => $parentId,
+ 'post_type' => get_post_type($parentId),
+ 'post_status' => ['publish', 'draft'],
+ 'orderby' => 'date',
+ 'order' => 'DESC',
+ 'fields' => 'ids'
+ ]);
+
+ // Count includes parent + children
+ $number = count($children) + 1;
+
+ // Update both meta fields
+ update_post_meta($parentId, BASE . 'number', $number);
+ update_post_meta($parentId, BASE . 'latest_date', time());
+ }
+
// ─────────────────────────────────────────────────────────────
// Helper methods
// ─────────────────────────────────────────────────────────────
--
Gitblit v1.10.0