[wp-trac] [WordPress Trac] #40764: Multisite theme update not showing new version number

WordPress Trac noreply at wordpress.org
Wed Aug 2 17:02:11 UTC 2017


#40764: Multisite theme update not showing new version number
-----------------------------+-------------------------
 Reporter:  afragen          |       Owner:  swissspidy
     Type:  defect (bug)     |      Status:  reviewing
 Priority:  normal           |   Milestone:  4.9
Component:  Upgrade/Install  |     Version:  4.6
 Severity:  normal           |  Resolution:
 Keywords:  has-patch        |     Focuses:  multisite
-----------------------------+-------------------------

Comment (by swissspidy):

 Replying to [comment:10 afragen]:
 > {{{$upgrader->skin->theme_info}}} already exists and it really does
 contain the current {{{theme_info}}}.
 >
 > If you want to explicitly get the current theme, that works too and
 might be easier to understand in code. I was simply trying to work with
 the data that currently existed.
 >
 > Thanks for the feedback. I appreciate it.

 You're right. I see now that there's a `$this->skin->theme_info =
 $this->theme_info($theme);` line in `Theme_Upgrader::bulk_upgrade()`. I
 got suspicious because `theme_info` isn't an explicit property of the
 skin. Plus, that property is set within a loop and could theoretically get
 overridden by accident in a future change. Thus, it's not really
 straightforward. It would be safer to use `Theme_Upgrader::theme_info()`
 directly within the Ajax callback. However, this is a) just a wrapper for
 `wp_get_theme()` and b) it was called too late anyway and never returned
 the old version.

 Regarding the conditional check in [attachment:40764.diff]: that doesn't
 work reliably. `$upgrader->skin->theme_info` can be `false`. Not checking
 for that can lead to warnings.

 `! empty( $upgrader->skin->theme_info )` is better, but still not an
 explicit check for `false` or `WP_Theme`. Also, `wp_get_theme()`
 recommends checking the `exists()` method, which is what I did in
 [attachment:40764.2.diff]

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40764#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list