• Resolved peter8nss

    (@peter8nss)


    I am tuning my site page loading and noticed that a lot of calls to the database to fetch __ina_* options. I was surprised that these options were not being loaded as part of wp_load_alloptions. However, on checking the database I noticed that all these options had been created with autoload=no.

    I think there is a problem in the logic of Helpers::update_option function:

    if ( is_network_admin() && is_multisite() || ( get_current_blog_id() == get_main_network_id() ) ) {
    update_site_option( $key, $value );
    } else {
    update_option( $key, $value );
    }

    This is going through the update_site_option branch despite my site NOT being a multisite. Note that update_site_option calls update_network_option which, in the case of not multsite, calls update_option with autoload=false. Hence, what I’m seeing in the database.

    I’ve checked each element of the if statement:

    • is_network_admin() = false
    • is_multisite() = false
    • get_current_blog_id() = 1
    • get_main_network_id() =1 (which is always the case if not multisite)

    So I think the if statement logic is flawed. Please could you have a look/correct this.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Deepen

    (@j_3rk)

    Hi Peter,

    Thanks for pointing this out. There does seem to be issue with this in current version and will fix this asap in coming week.

    Below should be the correct code for this.

    if ( is_multisite() && get_current_blog_id() == get_main_network_id() ) {
    update_site_option( $key, $value );
    } else {
    update_option( $key, $value, true );
    }

    I’ll be releasing next version with some tweaks. Cheers ??

    Thread Starter peter8nss

    (@peter8nss)

    Might be a problem that autoload value only gets updated if the option value actually changes. So those values with autoload set to “no” will stay at “no”.

    Plugin Author Deepen

    (@j_3rk)

    Its likely that you would need to re-update the data or run an sql to convert to “yes” for this.

    Thread Starter peter8nss

    (@peter8nss)

    I updated the database using WP CLI:

    wp db query "UPDATE <db>_options set autoload='yes' where option_name like '__ina%';"

    Also had to force a save of the role based settings as there was no value in the database for “__ina_enable_timeout_multiusers”. So that was still being individually loaded.

    Thanks for your help.

    Plugin Author Deepen

    (@j_3rk)

    __ina_enable_timeout_multiusers” is only saved when role based setting is enabled so that might be the case. Version 340 should solve this though.

    Plugin Author Deepen

    (@j_3rk)

    Hi there – this should be fixed in latest version updates so closing the issue. Please reply here or open a new thread for any new issues.

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.