fix cache problem

This commit is contained in:
isUnknown 2025-05-22 15:35:53 +02:00
parent 86f46b59cf
commit ca0ca3b2a2
2 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
<?php
return function($newPage, $oldPage) {
if ($newPage->template() == 'project' || $newPage->parents()->findBy('template', 'project')) {
$newPage->getSteps();
if ($newPage->template() == 'project' || $newPage->parents()->findBy('template', 'project')) {
$newPage->getSteps(true);
}
};

View file

@ -3,11 +3,11 @@
use adrienpayet\notifications\NotificationsPage;
class ProjectPage extends NotificationsPage {
public function getSteps() {
public function getSteps($refreshCache = false) {
$apiCache = kirby()->cache('api');
$stepsData = $apiCache->get($this->slug() . '_' . 'steps');
$stepsData = $apiCache->get($this->slug() . '_' . 'steps');
if ($stepsData === null || count($stepsData) === 0) {
if ($refreshCache) {
$steps = [];
foreach ($this->children() as $child) {