Skip to content

Commit

Permalink
Docs: Adjust comments about set_time_limit() per the documentation …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
SergeyBiryukov committed Oct 25, 2024
1 parent baf408f commit 43b64f5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/wp-admin/includes/ajax-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
6 changes: 5 additions & 1 deletion src/wp-admin/includes/class-wp-upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
5 changes: 4 additions & 1 deletion src/wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/class-pop3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down

0 comments on commit 43b64f5

Please sign in to comment.