Coding Standards: Clarify time units for various timeout or expiration values.

This changeset implements a clearer and more consistent timeout/duration/expiration format. It updates time durations used in various files, as per WordPress coding standards:

- If the value can be represented as an integer (not a fractional) number of minutes (hours, etc.), use the appropriate constant (e.g.: `MINUTE_IN_SECONDS`) multiplied by that number.
- Otherwise, keep the value as is and add a comment with the units for clarity.

Follow-up to [11823], [13177], [21996], [37747], [53714].

Props hztyfoon, audrasjb, arrasel403, krupalpanchal, GaryJ, SergeyBiryukov, peterwilsoncc, rudlinkon, costdev, robinwpdeveloper.
Fixes #56293.
See #55647.


git-svn-id: https://develop.svn.wordpress.org/trunk@54113 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jb Audras
2022-09-09 08:14:43 +00:00
parent f042981494
commit 912fb7666c
6 changed files with 11 additions and 11 deletions
+4 -4
View File
@@ -539,10 +539,10 @@ function wp_edit_theme_plugin_file( $args ) {
}
// Make sure PHP process doesn't die before loopback requests complete.
set_time_limit( 300 );
set_time_limit( 5 * MINUTE_IN_SECONDS );
// Time to wait for loopback requests to finish.
$timeout = 100;
$timeout = 100; // 100 seconds.
$needle_start = "###### wp_scraping_result_start:$scrape_key ######";
$needle_end = "###### wp_scraping_result_end:$scrape_key ######";
@@ -2007,10 +2007,10 @@ function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_own
* to allow for per-transport overriding of the default.
*/
if ( ! defined( 'FS_CONNECT_TIMEOUT' ) ) {
define( 'FS_CONNECT_TIMEOUT', MINUTE_IN_SECONDS / 2 );
define( 'FS_CONNECT_TIMEOUT', 30 ); // 30 seconds.
}
if ( ! defined( 'FS_TIMEOUT' ) ) {
define( 'FS_TIMEOUT', MINUTE_IN_SECONDS / 2 );
define( 'FS_TIMEOUT', 30 ); // 30 seconds.
}
if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->has_errors() ) {