[wp-trac] [WordPress Trac] #56293: Use 'MINUTE_IN_SECONDS' for consistency in 'update.php' file

WordPress Trac noreply at wordpress.org
Wed Jul 27 15:14:22 UTC 2022


#56293: Use 'MINUTE_IN_SECONDS' for consistency in 'update.php' file
-----------------------------------------+-------------------------------
 Reporter:  hztyfoon                     |       Owner:  audrasjb
     Type:  defect (bug)                 |      Status:  reviewing
 Priority:  normal                       |   Milestone:  6.1
Component:  Administration               |     Version:
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch changes-requested  |     Focuses:  coding-standards
-----------------------------------------+-------------------------------
Changes (by SergeyBiryukov):

 * keywords:  has-patch => has-patch changes-requested


Old description:

> In the 'wp-includes/update.php' file there are multiple instances where
> variable $timeout set to plain integer 30 like:
> {{{
> $timeout = 30;
> }}}
> I think It should be like this (MINUTE_IN_SECONDS also used multiple time
> in this file) as done here in this commit #53714:
>
> {{{
> $timeout = MINUTE_IN_SECONDS / 2;
> }}}

New description:

 In the 'wp-includes/update.php' file there are multiple instances where
 variable $timeout set to plain integer 30 like:
 {{{
 $timeout = 30;
 }}}
 I think It should be like this (MINUTE_IN_SECONDS also used multiple time
 in this file) as done here in this commit [53714]:

 {{{
 $timeout = MINUTE_IN_SECONDS / 2;
 }}}

--

Comment:

 Thanks everyone!
 {{{
 // Three seconds, plus one extra second for every 10 themes.
 $timeout = MINUTE_IN_SECONDS / 20 + (int) ( count( $themes ) / 10 )
 }}}
 I think `MINUTE_IN_SECONDS / 20` is also too complicated :) Keeping that
 as is, especially with the "Three seconds" comment above, seems more
 readable to me:
 {{{
 // Three seconds, plus one extra second for every 10 themes.
 $timeout = 3 + (int) ( count( $themes ) / 10 );
 }}}
 Same goes for this:
 {{{
 'timeout'    => $doing_cron ? MINUTE_IN_SECONDS / 2 : MINUTE_IN_SECONDS /
 20,
 }}}
 This might be more readable:
 {{{
 // Half a minute when doing cron tasks, 3 seconds otherwise.
 'timeout'    => $doing_cron ? MINUTE_IN_SECONDS / 2 : 3,
 }}}

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


More information about the wp-trac mailing list