From 43b64f581e39b7b1b087160c087b94fc70a8edc1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 25 Oct 2024 20:24:08 +0000 Subject: [PATCH] Docs: Adjust comments about `set_time_limit()` per the documentation standards. Includes splitting long comments into multiple lines and moving a few comments above the `function_exists()` check for more consistent placement. Follow-up to [59039], [59288]. See #62281. git-svn-id: https://develop.svn.wordpress.org/trunk@59291 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 2 +- src/wp-admin/includes/class-wp-upgrader.php | 6 +++++- src/wp-admin/includes/update-core.php | 5 ++++- src/wp-includes/class-pop3.php | 4 ++-- src/wp-includes/comment.php | 2 +- src/wp-includes/deprecated.php | 2 +- 6 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 27ec0d875251d..83b682634b075 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -3556,8 +3556,8 @@ function wp_ajax_get_revision_diffs() { $return = array(); + // Increase the script timeout limit to allow ample time for diff UI setup. if ( function_exists( 'set_time_limit' ) ) { - // Increase the script timeout limit to allow ample time for diff UI setup. set_time_limit( 5 * MINUTE_IN_SECONDS ); } diff --git a/src/wp-admin/includes/class-wp-upgrader.php b/src/wp-admin/includes/class-wp-upgrader.php index a9784682ebb0f..c47773569fc17 100644 --- a/src/wp-admin/includes/class-wp-upgrader.php +++ b/src/wp-admin/includes/class-wp-upgrader.php @@ -525,7 +525,11 @@ public function install_package( $args = array() ) { $destination = $args['destination']; $clear_destination = $args['clear_destination']; - // Give the upgrade an additional 300 seconds(5 minutes) to ensure the install doesn't prematurely timeout having used up the maximum script execution time upacking and downloading in WP_Upgrader->run. + /* + * Give the upgrade an additional 300 seconds (5 minutes) to ensure the install + * doesn't prematurely timeout having used up the maximum script execution time + * upacking and downloading in WP_Upgrader->run(). + */ if ( function_exists( 'set_time_limit' ) ) { set_time_limit( 300 ); } diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 297c931bc086b..d5c4385c7e4da 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -970,8 +970,11 @@ function update_core( $from, $to ) { global $wp_filesystem, $_old_files, $_old_requests_files, $_new_bundled_files, $wpdb; + /* + * Give core update script an additional 300 seconds (5 minutes) + * to finish updating large files when running on slower servers. + */ if ( function_exists( 'set_time_limit' ) ) { - // Gives core update script time an additional 300 seconds(5 minutes) to finish updating large files or run on slower servers. set_time_limit( 300 ); } diff --git a/src/wp-includes/class-pop3.php b/src/wp-includes/class-pop3.php index b4eab75044169..aec31dc7f145c 100644 --- a/src/wp-includes/class-pop3.php +++ b/src/wp-includes/class-pop3.php @@ -59,8 +59,8 @@ function __construct ( $server = '', $timeout = '' ) { if(!empty($timeout)) { settype($timeout,"integer"); $this->TIMEOUT = $timeout; + // Extend POP3 request timeout to the specified TIMEOUT property. if(function_exists("set_time_limit")){ - // Extends POP3 request timeout to specified TIMEOUT property. set_time_limit($timeout); } } @@ -75,8 +75,8 @@ public function POP3( $server = '', $timeout = '' ) { } function update_timer () { + // Extend POP3 request timeout to the specified TIMEOUT property. if(function_exists("set_time_limit")){ - // Allows additional extension of POP3 request timeout to specified TIMEOUT property when update_timer is called. set_time_limit($this->TIMEOUT); } return true; diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php index d1dacf243e05f..ce37558d047e3 100644 --- a/src/wp-includes/comment.php +++ b/src/wp-includes/comment.php @@ -3120,8 +3120,8 @@ function pingback( $content, $post ) { $pingback_server_url = discover_pingback_server_uri( $pagelinkedto ); if ( $pingback_server_url ) { + // Allow an additional 60 seconds for each pingback to complete. if ( function_exists( 'set_time_limit' ) ) { - // Allows an additional 60 seconds for each pingback to complete. set_time_limit( 60 ); } diff --git a/src/wp-includes/deprecated.php b/src/wp-includes/deprecated.php index 0b16147d5f224..1aaedd0474f7b 100644 --- a/src/wp-includes/deprecated.php +++ b/src/wp-includes/deprecated.php @@ -3673,7 +3673,7 @@ function post_permalink( $post = 0 ) { function wp_get_http( $url, $file_path = false, $red = 1 ) { _deprecated_function( __FUNCTION__, '4.4.0', 'WP_Http' ); - // Adds an additional 60 seconds to the script timeout to ensure the remote request has enough time. + // Add 60 seconds to the script timeout to ensure the remote request has enough time. if ( function_exists( 'set_time_limit' ) ) { @set_time_limit( 60 ); }