Fix : problème de mémoire lors du chargement des projets
Problème : projects.json.php collectait les notifications dérivées pour TOUS les projets d'un coup, ce qui causait un dépassement de mémoire (HTTP 500). Solution : - projects.json.php : Ne collecte plus les notifications (retourne []) - project.json.php : Collecte les notifications uniquement pour le projet affiché Les notifications seront chargées à la demande quand on ouvre un projet, pas lors du listing initial. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f614884da0
commit
0250dc1487
2 changed files with 21 additions and 22 deletions
|
|
@ -1,5 +1,18 @@
|
|||
<?php
|
||||
|
||||
// Récupérer le collector de notifications pour ce projet individuel
|
||||
$notificationCollector = $kirby->option('adrienpayet.pdc-notifications.collector');
|
||||
$notifications = [];
|
||||
|
||||
if ($notificationCollector && $kirby->user()) {
|
||||
try {
|
||||
$notifications = $notificationCollector->collect($page, $kirby->user());
|
||||
} catch (\Throwable $e) {
|
||||
error_log("Error collecting notifications for project {$page->uri()}: " . $e->getMessage());
|
||||
$notifications = [];
|
||||
}
|
||||
}
|
||||
|
||||
$project = [
|
||||
'title' => $page->title()->value(),
|
||||
'url' => $page->url(),
|
||||
|
|
@ -11,7 +24,7 @@ $project = [
|
|||
'steps' => $page->getSteps(),
|
||||
'designToLight' => $page->isDTLEnabled()->isTrue() ? processDTLProposals($page) : null,
|
||||
'hasOptimizationRequest' => $page->hasOptimizationRequest()->isTrue(),
|
||||
'notifications' => $page->notifications()->yaml(),
|
||||
'notifications' => $notifications,
|
||||
];
|
||||
|
||||
$pageData = array_merge($genericData, $project);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue