[wp-trac] [WordPress Trac] #24496: Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade() sanity checks
WordPress Trac
noreply at wordpress.org
Fri Aug 9 00:12:01 UTC 2013
#24496: Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade() sanity
checks
---------------------------------+------------------
Reporter: jamescollins | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.7
Component: Upgrade/Install | Version: 2.9
Severity: normal | Resolution:
Keywords: has-patch 3.7-early |
---------------------------------+------------------
Comment (by jamescollins):
Hi @ryan,
If no plugins/themes are selected when using the WordPress admin interface
to upgrade, plugins/themes a message of
{{{Please select one or more plugins to update.}}}
or
{{{Please select one or more themes to update.}}}
is displayed (via http://core.trac.wordpress.org/browser/trunk/src/wp-
admin/update-core.php#L436), which means the
Plugin_Upgrader::bulk_upgrade() and Theme_Upgrader::bulk_upgrade()
functions don't get executed at all.
So the only case where an empty array could be passed to the
bulk_upgrade() function is via third party code (such as WP CLI), in which
case I think it is ok to simply return an empty array and output nothing.
{{{24496.4.diff}}} does this.
Alternatively, if you think it is still best to output the header/footer
information, then my approach in {{{24496.3.diff}}} could make sense. I
thought an explicit if statement was easier to read and understand
compared to your suggested alternative.
My preferred approach is {{{24496.4.diff}}}.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/24496#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list