• Resolved dsusco

    (@dsusco)


    We’re seeing a ton of update queries (one per site, I’m guessing) from update_blog_option coming from line 530 of src/authorizer/class-updates.php

    I think it should be:

    update_blog_option( get_network()->blog_id, 'auth_version', $auth_version );

    not:

    update_blog_option( $blog_id, 'auth_version', $auth_version );

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Paul Ryan

    (@figureone)

    Good catch! We’ll get that tested (need to make sure it still works if Authorizer is installed on a single site in the network and not network-activated) and then release an updated version.

    Paul, I don’t know if you’ve caught this, but an additional change is needed in order to prevent the update code from writing to all of the wp_{number}_options tables:

    From line 30:

    $network_active = is_plugin_active_for_network('authorizer');
    
    if ( is_multisite()  && ! $network_active) {
    	$auth_version = get_blog_option( get_network()->blog_id, 'auth_version' );
    } else {
    	$auth_version = get_option( 'auth_version' );
    }

    On line 525:

    if ( is_multisite() && ! $network_active) { ...
    

    I patched these changes into our production site today and it cut about 25 second off the load time of one of our private subsites. For reference, we currently have 184 subsites on our main website.

    Plugin Author Paul Ryan

    (@figureone)

    I think we’ve got a couple things going on here. First, we’ve patched the original issue where the Authorizer version string was being written to all subsite wp_{number}_options tables. Now it just stores one master version on a multisite install in wp_options: https://github.com/uhm-coe/authorizer/commit/43fe01dfde333cfd52e456cd89db37cf7fe5137d

    Second, class-updates.php contains any database migrations needed when updating to a new version of Authorizer (these are triggered if the version string is out of date). Some of them actually do need to write to the options tables of all subsites, to create new Authorizer options added in a new version. It’s possible your server is timing out during this process, resulting in the version string never getting updated to the latest (the last step of the process), so it will endlessly try to keep updating. If this is the case, I suggest setting a longer max_execution_time in PHP to allow the update process to complete.

    Finally, we also added a performance fix where the update routine was updating the main Authorizer multisite options for each subsite. This should trim some time off of that update routine: https://github.com/uhm-coe/authorizer/commit/3313163b0560d938730eb3dc3e281b1a123d9bb8

    These will be included in the next release, due out shortly

    Plugin Author Paul Ryan

    (@figureone)

    Aloha, version 3.6.2 is released with these changes, let us know if you run into any issues!

    Thread Starter dsusco

    (@dsusco)

    Thanks Paul, Mark put the plugin on our dev instance and it seems good so far.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘lots of queries from class-updates.php when using multisite’ is closed to new replies.