[wp-trac] [WordPress Trac] #27669: Stale `db_version` value after update with external object cache

WordPress Trac noreply at wordpress.org
Thu Sep 8 23:04:24 UTC 2016


#27669: Stale `db_version` value after update with external object cache
-------------------------------------+-----------------------------
 Reporter:  johnbillion              |       Owner:
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  Future Release
Component:  Upgrade/Install          |     Version:  3.9
 Severity:  critical                 |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:
-------------------------------------+-----------------------------

Comment (by Mike_Cowobo):

 Another scenario that could trigger this is when WP is updated on in a
 staging environment and deployed without a cache flush. This should
 obviously not happen at all, but I saw this happen recently one of the
 bigger WP hosting providers offering integrated staging.

 To reproduce the "No Update Required" loop with WP CLI:
 {{{#!php
 $alloptions = wp_load_alloptions();
 $alloptions['db_version'] = 36685; // Any version but $wp_db_version
 wp_cache_set( 'alloptions', $alloptions, 'options' );
 }}}

 A more robust solution would be to actually check the option in the db in
 `wp-admin/admin.php` when db_version != $wp_db_version and flush the cache
 if a discrepancy is detected. This will:
 * Only cause a DB query when upgrade is required, or when something is
 actually wrong
 * Always work, regardless of when and where db_version was updated

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27669#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list