Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

`postDate` is not respected as cache TTL

Aperta
#187 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
php
Ambito
api, backend

Direzione di ricerca

Inizia dal percorso della richiesta di Element API per le query Entry utilizzando i criteri di stato live e pending, quindi traccia il modo in cui la cache delle risposte gestisce il postDate di un Entry. Riproduci lo scenario in sette passaggi con Craft 4.8.1 e conferma che l’API restituisca dati aggiornati di enabledForSite e status quando l’Entry diventa pubblico.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug repo:element-api
Description

When an Entry has a postDate in the future (pending) the \craft\base\Element::@$enabledForSite is disabled.

Once the postDate is in the past this (and other fields) becomes enabled, but the API will still return the old disabled value. Adding a random cache-busting query parameter to the API call will return the correct new state.

We use Craft as a headless CMS and want to be able to schedule articles in the future. However the cache isn't expired when the postDate is in the past.

Steps to reproduce
  1. Create an Entry that will be published in the future
  2. Request the Entry via the API with the criteria status set to [Entry::STATUS_LIVE, Entry::STATUS_PENDING]
  3. Observe the enabledForSite state being false
  4. Wait for the Entry to become public
  5. Refetch the data via the API
  6. The enabledForSite is still reported as false
  7. Of course all other data is also stale; the status etc etc
Additional info
  • Craft version: 4.8.1
  • PHP version: 8.1
  • Database driver & version: mysql 5.7
  • Plugins & versions: Element API 3.0.1.1
Lingua principale
PHP
Stelle
502
Fork
55
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.