[wp-trac] [WordPress Trac] #21270: Use update_blog_option() when enabling/disabling themes per site in Multisite

WordPress Trac wp-trac at lists.automattic.com
Sat Jul 14 05:07:31 UTC 2012


#21270: Use update_blog_option() when enabling/disabling themes per site in
Multisite
--------------------------+-----------------------------
 Reporter:  jeremyfelt    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Multisite     |    Version:
 Severity:  minor         |   Keywords:  has-patch
--------------------------+-----------------------------
 Currently, when site/theme options are changed in site-themes.php, we use
 `update_option( 'allowedthemes', $allowed_themes )`.

 This seems to cause an object cache related issue after the save and
 redirect when the table is displayed again. After clicking enable or
 disable next to a theme, no change is obvious, but the database is still
 updated.

 When `get_allowed_on_site()` fires in class-wp-theme.php, and `$current`
 evaluates to false, we use `get_blog_option( $blog_id, 'allowedthemes' )`
 to grab the data, which looks first to an object cache key that is not set
 on update in site-themes.php:

 {{{$key = $blog_id . '-' . $setting . '-blog_option'}}}

 When object cache is not available, this falls back to `get_option()`,
 which pulls the data as intended.

 This patch modifies site-themes.php to use `update_blog_option( $id,
 'allowedthemes', $allowed_themes )`. This continues to set the original
 `update_option()` but provides for the correct cache key/value as well.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21270>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list