[wp-trac] [WordPress Trac] #37685: Creating new multisite blog - wpmu_create_blog tries to execute queries on non-existent tables

WordPress Trac noreply at wordpress.org
Wed Aug 17 10:04:47 UTC 2016


#37685: Creating new multisite blog - wpmu_create_blog tries to execute queries on
non-existent tables
--------------------------------+-----------------------------
 Reporter:  fliespl             |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Networks and Sites  |    Version:
 Severity:  normal              |   Keywords:
  Focuses:  multisite           |
--------------------------------+-----------------------------
 I have noticed that while creating new wordpress site in multisite install
 I get quite a few notices about executed queries while using verbose
 logging.

 {{{
 query: SELECT option_name, option_value FROM wp_85_options WHERE autoload
 = 'yes'
 status: ERR: Table 'wp1.wp_85_options' doesn't exist
 }}}
 which is triggered by `wp_roles()->reinit();` during switch_to_blog
 function


 Another are from get_blogaddress_by_id (inside install_blog function):

 {{{
 query: SELECT option_name, option_value FROM wp_85_options
 status: ERR: Table 'wp1.wp_85_options' doesn't exist

 query: SELECT option_value FROM wp_85_options WHERE option_name = 'home'
 LIMIT 1
 status: ERR: Table 'wp1.wp_85_options' doesn't exist

 query: SELECT option_value FROM wp_85_options WHERE option_name =
 'blogname' LIMIT 1
 status: ERR: Table 'wp1.wp_85_options' doesn't exist

 query: SELECT option_value FROM wp_85_options WHERE option_name =
 'siteurl' LIMIT 1
 status: ERR: Table 'wp1.wp_85_options' doesn't exist

 query: SELECT option_value FROM wp_85_options WHERE option_name =
 'post_count' LIMIT 1
 status: ERR: Table 'wp1.wp_85_options' doesn't exist

 query: SELECT option_name, option_value FROM wp_85_options WHERE autoload
 = 'yes'
 status: ERR: Table 'wp1.wp_85_options' doesn't exist

 }}}


 Wouldn't it make sense to skip execution of those queries unless tables
 has been created?

 1. `get_blogaddress_by_id` calls get_blog_details with $get_all as true
 while it makes no sense since additional fields will either be empty.
 2. Do not call reinit of wp_roles if in blog creation mode

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


More information about the wp-trac mailing list