[wp-trac] [WordPress Trac] #55402: Check for and retain custom indexes on version upgrades

WordPress Trac noreply at wordpress.org
Tue Aug 9 22:35:15 UTC 2022


#55402: Check for and retain custom indexes on version upgrades
-------------------------+------------------------------
 Reporter:  amykamala    |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Database     |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:1 OllieJones]:
 > If a plugin could hook the  'dbdelta_queries' filter, it could intercept
 the data-definition language SQL statements that core update emits.  This
 would be a good way for plugins to control index changes during version
 updates.
 >
 > But, unfortunately, plugins aren't active during the database update
 phase of core's version update process.

 Indeed. When I briefly
 [https://github.com/WordPress/performance/issues/132#issuecomment-1028386786
 looked into this previously], it seemed like `wp-load.php` would load
 plugins as part of the general bootstrap process. However, I missed that
 `wp-admin/upgrade.php` defines `WP_INSTALLING` as true, and then
 `wp_get_active_and_valid_plugins()` [source:tags/6.0/src/wp-
 includes/load.php?marks=815,824-826#L800 returns an empty array].

 So the `dbdelta_queries` filter is not available for regular plugins. That
 said, it is available for [https://wordpress.org/support/article/must-use-
 plugins/ "must-use" plugins] (located in `wp-content/mu-plugins`), which
 don't check for `wp_installing()` and are [source:tags/6.0/src/wp-
 includes/load.php#L768 loaded regardless of it].

 > Maybe a valid fix to this issue could be a way to make at least some
 plugins active during version update.

 Since "must-use" plugins are always active, would that be helpful here?

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


More information about the wp-trac mailing list