Bug description
EntryScheduleReached doesn't invalidate the related stache entry when a entry's schedule is reached entry remains unavailable until either the stache is cleared or the entry is saved again.
How to reproduce
- Publish an entry in the future
- Run the scheduler:
php artisan schedule:work - Wait for scheduled time to pass
- Confirm entry is set to published in list view in CP
- Query for the entry e.g. with
Entry::query and where('status', 'published'), entry will not be returned - Clear the stache or resave the entry
- Query for the entry e.g. with
Entry::query and where('status', 'published'), entry will be returned
This can also be confirmed by implementing this workaround which pro-actively saves the entry on the EntryScheduleReached event:
class EntryScheduleReachedListener
{
public function handle($event)
{
// Addresses Statamic bug that doesn't update the stache on publish
// https://github.com/statamic/cms/issues/11945
$entry = $event->entry;
$entry->save();
}
}
Logs
Environment
root@backend:/var/www/html# php please support:detailsEnvironmentApplication Name: <redacted>Laravel Version: 11.45.1PHP Version: 8.3.22Composer Version: 2.8.9Environment: localDebug Mode: ENABLEDURL: <redacted>Maintenance Mode: OFFTimezone: UTCLocale: enCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: fileDatabase: sqliteLogs: stack / singleMail: smtpQueue: syncSession: fileStatamicAddons: 4Sites: 1Stache Watcher: DisabledStatic Caching: DisabledVersion: 5.58.1 PROStatamic Addonsalt-design/alt-redirect: 1.3.3aryehraber/statamic-logbook: 3.3.0jacksleight/statamic-bard-texstyle: 3.5.6stillat/relationships: 2.2.1
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
Bug description
EntryScheduleReacheddoesn't invalidate the related stache entry when a entry's schedule is reached entry remains unavailable until either the stache is cleared or the entry is saved again.How to reproduce
php artisan schedule:workEntry::queryandwhere('status', 'published'), entry will not be returnedEntry::queryandwhere('status', 'published'), entry will be returnedThis can also be confirmed by implementing this workaround which pro-actively saves the entry on the
EntryScheduleReachedevent:Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response