[wp-trac] [WordPress Trac] #41699: Expired transients are not flushed by cron

WordPress Trac noreply at wordpress.org
Tue Aug 22 10:54:21 UTC 2017


#41699: Expired transients are not flushed by cron
--------------------------------+-----------------------------
 Reporter:  bor0                |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  4.8.1
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 Hi there.

 Is there a special reason why we delete expired transients only on
 `get_transient` attempt
 (https://github.com/WordPress/WordPress/blob/master/wp-
 includes/option.php#L662), but not in `cron.php`?

 I believe https://github.com/WordPress/WordPress/blob/master/wp-
 admin/includes/upgrade.php#L1748-L1759 belongs in `cron.php`. Otherwise
 we're having leftover transients until it's attempted to retrieve them.

 I will assume two cases from here:
 - It was done due to performance reasons. In which case there could've
 been a button in the wp-admin somewhere to flush the expired transients,
 or allow the users to enable/disable cron deletion through a config param
 in `wp-config.php`.
 - It was a bad design decision. In which case we can copy the excerpt from
 `upgrade.php` to `cron.php` somewhere.

 In any case, I believe the fix is easy and doesn't have a big impact,
 while at the same time it allows us to keep the DB from being polluted.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41699>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list