Use update_blog_option() when enabling/disabling themes per site in Multisite
|Reported by:||jeremyfelt||Owned by:||ryan|
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.
Change History (20)
- Component changed from Multisite to Cache
- Keywords needs-patch added; has-patch removed
- Milestone changed from Awaiting Review to 3.5
- Owner set to ryan
- Resolution set to fixed
- Status changed from new to closed