This commit is contained in:
Jürgen Mummert
2025-12-23 12:47:50 +01:00
parent c71554b18c
commit 5a65aa00eb
+26 -26
View File
@@ -15,22 +15,22 @@ class IndexPageListener
$debug = (PHP_SAPI === 'cli'); $debug = (PHP_SAPI === 'cli');
if ($debug) { if ($debug) {
echo "\n=============================\n"; fwrite(STDERR, "\n=============================\n");
echo "INDEXPAGE LISTENER\n"; fwrite(STDERR, "INDEXPAGE LISTENER\n");
echo "URL: " . ($set['url'] ?? $data['url'] ?? '[unknown]') . "\n"; fwrite(STDERR, "URL: " . ($set['url'] ?? $data['url'] ?? '[unknown]') . "\n");
} }
// Marker vorhanden? // Marker vorhanden?
if (!str_contains($content, 'MEILISEARCH_JSON')) { if (!str_contains($content, 'MEILISEARCH_JSON')) {
if ($debug) { if ($debug) {
echo "❌ MEILISEARCH_JSON not found\n"; fwrite(STDERR, "❌ MEILISEARCH_JSON not found\n");
echo "=============================\n"; fwrite(STDERR, "=============================\n");
} }
return; return;
} }
if ($debug) { if ($debug) {
echo "✔ MEILISEARCH_JSON marker found\n"; fwrite(STDERR, "✔ MEILISEARCH_JSON marker found\n");
} }
// JSON aus Kommentar extrahieren + parsen // JSON aus Kommentar extrahieren + parsen
@@ -38,15 +38,15 @@ class IndexPageListener
if ($parsed === null) { if ($parsed === null) {
if ($debug) { if ($debug) {
echo "❌ JSON could not be parsed\n"; fwrite(STDERR, "❌ JSON could not be parsed\n");
echo "=============================\n"; fwrite(STDERR, "=============================\n");
} }
return; return;
} }
if ($debug) { if ($debug) {
echo "✔ JSON parsed successfully:\n"; fwrite(STDERR, "✔ JSON parsed successfully:\n");
print_r($parsed); fwrite(STDERR, print_r($parsed, true));
} }
/* /*
@@ -63,7 +63,7 @@ class IndexPageListener
$set['priority'] = (int) $priority; $set['priority'] = (int) $priority;
if ($debug) { if ($debug) {
echo "✔ priority set to: {$set['priority']}\n"; fwrite(STDERR, "✔ priority set to: {$set['priority']}\n");
} }
} }
@@ -95,7 +95,7 @@ class IndexPageListener
$set['keywords'] = implode(' ', array_unique($kw)); $set['keywords'] = implode(' ', array_unique($kw));
if ($debug) { if ($debug) {
echo "✔ keywords set to: {$set['keywords']}\n"; fwrite(STDERR, "✔ keywords set to: {$set['keywords']}\n");
} }
} }
@@ -111,30 +111,28 @@ class IndexPageListener
$parsed['custom']['searchimage'] ?? null; $parsed['custom']['searchimage'] ?? null;
if ($debug) { if ($debug) {
echo "Resolved image UUID: "; fwrite(STDERR, "Resolved image UUID: " . var_export($image, true) . "\n");
var_dump($image);
} }
if (is_string($image) && $image !== '') { if (is_string($image) && $image !== '') {
if ($debug) { if ($debug) {
echo "→ Calling MeilisearchImageHelper\n"; fwrite(STDERR, "→ Calling MeilisearchImageHelper\n");
} }
$path = $this->imageHelper->getImagePathFromUuid($image); $path = $this->imageHelper->getImagePathFromUuid($image);
if ($debug) { if ($debug) {
echo "← Image helper returned: "; fwrite(STDERR, "← Image helper returned: " . var_export($path, true) . "\n");
var_dump($path);
} }
if ($path !== null) { if ($path !== null) {
$set['imagepath'] = $path; $set['imagepath'] = $path;
if ($debug) { if ($debug) {
echo "✔ imagepath set to: {$set['imagepath']}\n"; fwrite(STDERR, "✔ imagepath set to: {$set['imagepath']}\n");
} }
} elseif ($debug) { } elseif ($debug) {
echo "❌ image helper returned NULL\n"; fwrite(STDERR, "❌ image helper returned NULL\n");
} }
} }
@@ -148,8 +146,7 @@ class IndexPageListener
$parsed['news']['date'] ?? null; $parsed['news']['date'] ?? null;
if ($debug) { if ($debug) {
echo "Resolved date: "; fwrite(STDERR, "Resolved date: " . var_export($date, true) . "\n");
var_dump($date);
} }
if (is_string($date) && $date !== '') { if (is_string($date) && $date !== '') {
@@ -159,22 +156,25 @@ class IndexPageListener
$set['startDate'] = $ts; $set['startDate'] = $ts;
if ($debug) { if ($debug) {
echo "✔ startDate set to timestamp: {$set['startDate']}\n"; fwrite(STDERR, "✔ startDate set to timestamp: {$set['startDate']}\n");
} }
} elseif ($debug) { } elseif ($debug) {
echo "❌ strtotime failed\n"; fwrite(STDERR, "❌ strtotime failed\n");
} }
} }
if ($debug) { if ($debug) {
echo "---- FINAL \$set ----\n"; fwrite(STDERR, "---- FINAL \$set ----\n");
fwrite(
STDERR,
print_r([ print_r([
'priority' => $set['priority'] ?? null, 'priority' => $set['priority'] ?? null,
'keywords' => $set['keywords'] ?? null, 'keywords' => $set['keywords'] ?? null,
'imagepath' => $set['imagepath'] ?? null, 'imagepath' => $set['imagepath'] ?? null,
'startDate' => $set['startDate'] ?? null, 'startDate' => $set['startDate'] ?? null,
]); ], true)
echo "=============================\n"; );
fwrite(STDERR, "=============================\n");
} }
} }