Solve Operation Timed Out Error When Upgrading WordPress

WordPress 2.7 comes with a built-in automatic upgrade utilities, inside the control panel. Recently, WordPress has just released version 2.7.1. I would like to upgrade it automatically, to save me the hassle of downloading, ftp-ing or installing it manually.
However, many times have I experienced “Operation Timed Out” followed by “Installation Failed” when doing so. Below are the error I’m talking about (or something similar):

Downloading update from http://wordpress.org/wordpress-2.7.1.zip

Download failed.: Operation timed out after 30000 milliseconds with 351500 bytes received

Installation Failed

Below is what I did to resolve the error:

1. Go to your WordPress installation directory on your website.
2. Go to /wp-admin/includes/ folder.
3. Open/edit the file.php . Or you can download the file to your local computer for editing.
4. Look for the line;
$response = wp_remote_get($url, array(’timeout’ => 30));
and replace it with;
$response = wp_remote_get($url, array(’timeout’ => 120));

5. Save the file, or upload back the file. Be sure to backup the original file.
6. Try the “Automatic Upgrade” once again.

Your upgrade should be working fine now, without the “Operation Timed Out” error. You didn’t hear this from me, it’s from a reference Download failed.: Operation timed out after 30 seconds.

– WordPress: Code is Poetry