[wp-trac] [WordPress Trac] #37984: Relocate either dbDelta() or wp_should_upgrade_global_tables() out of upgrade.php

WordPress Trac noreply at wordpress.org
Thu Sep 8 07:55:45 UTC 2016


#37984: Relocate either dbDelta() or wp_should_upgrade_global_tables() out of
upgrade.php
-----------------------------+-----------------------------
 Reporter:  johnjamesjacoby  |      Owner:
     Type:  enhancement      |     Status:  new
 Priority:  low              |  Milestone:  Awaiting Review
Component:  Database         |    Version:  4.3
 Severity:  minor            |   Keywords:  2nd-opinion
  Focuses:  performance      |
-----------------------------+-----------------------------
 I have a need to use `dbDelta()` inside a plugin that creates custom
 global database tables.

 I'd like to use `wp_should_upgrade_global_tables()` before deciding to
 pull in all of `upgrade.php` just to use `dbDelta()`. This is not
 currently possible, because `wp_should_upgrade_global_tables()` is located
 inside of `upgrade.php` along with `dbDelta()`, meaning I need to pull in
 that file on every `admin_init`, just to check if the environment is right
 to allow global table upgrades to continue.

 In my research of how to best solve this problem for myself, I see 1 of 2
 possible outcomes:
 * Move `dbDelta()`, `wp_should_upgrade_global_tables()` or both, out of
 `upgrade.php`, probably to `load.php`
 * Leave it alone, deal with plugins burning a few extra CPU cycles, and
 close this issue as wontfix, because having either of these two functions
 always included doesn't make much sense either

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


More information about the wp-trac mailing list