#51129 closed defect (bug) (fixed)
Avoid the Enable/Disable auto-updates links to appear for externally hosted themes on the Network Admin > Themes screen
Reported by: | audrasjb | Owned by: | pbiron |
---|---|---|---|
Milestone: | 5.5.1 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Upgrade/Install | Keywords: | has-patch has-screenshots |
Focuses: | multisite | Cc: |
Description (last modified by )
This is a follow-up to #50280
As noted by @pbiron in comment number 66:
The above (Note: see [48688]) commit did not include the requisite changes to WP_MS_Themes_List_Table
. The impact is that in multisite, the Enable/Disable auto-updates
links will still appear for externally hosted themes on the Network Admin > Themes
screen.
I'm looking into what it will take to add the multisite support for this. It's complicated by the fact that plugins use an array (returned by get_plugin_data()
) and thus can use array_merge()
on the info in the transient, array( 'update-supported => true )
and the plugin_data; whereas themes use an instance of WP_Theme
...making the array merge not possible.
I think something can be worked out using the magic __get()
and __set()
methods of WP_Theme
...but still looking into that.
Attachments (6)
Change History (22)
#4
@
4 years ago
I don't know how I messed up your description edit @SergeyBiryukov, but I think I fixed it.
This ticket was mentioned in Slack in #core-auto-updates by audrasjb. View the logs.
4 years ago
#6
@
4 years ago
- Keywords has-patch dev-feedback needs-testing added; needs-patch removed
Initial pass at a patch. This should correctly do the following.
- Count the number of enabled/disabled auto-updates in the network themes tabs.
- Correctly display or not display the auto-update link.
- Add the
auto_update_theme
filter to multisite.
I'm certain this isn't complete, but it's a start.
#7
@
4 years ago
- Keywords dev-feedback removed
Thanx for the patch @afragen
51129.2.diff builds on it and I think brings the multisite themes list table into parity with the plugins list table, as far as how the "Automatic Updates" column is populated.
A few things to note:
- it does not relying on the
__get()
and__set()
magic methods ofWP_theme
(as suggested in my comment on the other ticket). It simply dynamically creates theupdate_supported
andauto_update_forced
properties of theWP_Theme
objects as needed. - notice that those property names are slightly different than the dynamic array keys used in the plugins list table (which are
update-supported
andauto-update-forced
). That makes it easier to get/set those dynamic properties. We could use$theme->{'update-supported'}
, but that syntax of really hard to deal with :-) - it correctly (I think) displays
Auto-update enabled
orAuto-update disabled
as plain text (instead of the normal enable/disable links) when theauto_update_theme
filter returns a non-null value (51129.diff didn't do that)
With 5.5.1-RC1 scheduled for tomorrow, this could use some testing ASAP.
This ticket was mentioned in Slack in #core by pbiron. View the logs.
4 years ago
#10
@
4 years ago
Fixes a loose comparison that exists in class-wp-plugins-list-table.php line 1127 that was copied. Discussed with @pbiron.
@SergeyBiryukov you might want to fix that 🙃
#11
@
4 years ago
- Keywords has-screenshots added; needs-testing removed
Just tested the last patch on a multisite with a custom theme and it works fine.
I also reviewed the code and it looks good on my side.
So I have a patch that seems to correctly set the auto-update tabs count in
prepare_items()
and correctly adds/removes theEnable|Disable auto-updates
links incolumn_autoupdates()
.Themes are very much different from plugins as we know.
I'm missing why we actually need the theme headers for setting the auto-updates. Can someone explain this a bit for me? I've been working with plugin/theme updates for a while and know I can add the
array( 'update-supported => true )
if it's really needed.