Opened 3 years ago
Last modified 5 months ago
#37685 new defect (bug)
Creating new multisite blog - wpmu_create_blog tries to execute queries on non-existent tables
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | |
| Component: | Networks and Sites | Keywords: | reporter-feedback |
| Focuses: | multisite | Cc: | |
| PR Number: |
Description
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?
get_blogaddress_by_idcalls get_blog_details with $get_all as true while it makes no sense since additional fields will either be empty.- Do not call reinit of wp_roles if in blog creation mode
Change History (7)
#2
@
3 years ago
@johnjamesjacoby Those are logs from a multisite that was customized at some parts due to size/amount of traffic.
Yet I am pretty confident (99%) that those errors were not triggered by them - I have checked full backtrace that lead to this notices and those were happening (and triggered) solely by core functions (before any plugin / modification hopped in).
Still, I will create later today a clean site without any modifications just to be 100% sure.
#3
@
3 years ago
Have you been able to reproduce the problem on a clean site? Are you running WordPress 4.6 or an older version?
#4
@
3 years ago
I have confirmed it with wordpress 4.6 using such script in mu-plugins
add_filter('shutdown', function() {
global $EZSQL_ERROR;
file_put_contents(ABSPATH.'/errors.log', print_r($EZSQL_ERROR, true)."\n\n", FILE_APPEND);
});
Errors logged:
[0] => Array
(
[query] => SELECT option_value FROM wp_4_options WHERE option_name = 'wp_4_user_roles' LIMIT 1
[error_str] => Table 'site.wp_4_options' doesn't exist
)
[1] => Array
(
[query] => DESCRIBE wp_4_posts
[error_str] => Table 'site.wp_4_posts' doesn't exist
)
[2] => Array
(
[query] => SELECT option_value FROM wp_4_options WHERE option_name = 'blogname' LIMIT 1
[error_str] => Table 'site.wp_4_options' doesn't exist
)
[3] => Array
(
[query] => SELECT option_value FROM wp_4_options WHERE option_name = 'siteurl' LIMIT 1
[error_str] => Table 'site.wp_4_options' doesn't exist
)
[4] => Array
(
[query] => SELECT option_value FROM wp_4_options WHERE option_name = 'post_count' LIMIT 1
[error_str] => Table 'site.wp_4_options' doesn't exist
)
[5] => Array
(
[query] => SELECT option_value FROM wp_4_options WHERE option_name = 'home' LIMIT 1
[error_str] => Table 'site.wp_4_options' doesn't exist
)
Hey @fliespl. Thanks for the report. Do you have any plugins activated on this installation? If so, are you comfortable listing them here? (I'd like to rule out the chance that a plugin is interfering with the core functionality of the
wpmu_create_blog()function.)