Changeset 8317 for trunk/wp-admin/includes/update.php
- Timestamp:
- 07/11/2008 10:04:03 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/wp-admin/includes/update.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/update.php
r8305 r8317 53 53 echo "<span id='wp-version-message'>$msg</span>"; 54 54 } 55 56 function wp_update_plugins() {57 global $wp_version;58 59 if ( !function_exists('fsockopen') )60 return false;61 62 $plugins = get_plugins();63 $active = get_option( 'active_plugins' );64 $current = get_option( 'update_plugins' );65 66 $new_option = '';67 $new_option->last_checked = time();68 69 $plugin_changed = false;70 foreach ( $plugins as $file => $p ) {71 $new_option->checked[ $file ] = $p['Version'];72 73 if ( !isset( $current->checked[ $file ] ) ) {74 $plugin_changed = true;75 continue;76 }77 78 if ( strval($current->checked[ $file ]) !== strval($p['Version']) )79 $plugin_changed = true;80 }81 82 if (83 isset( $current->last_checked ) &&84 43200 > ( time() - $current->last_checked ) &&85 !$plugin_changed86 )87 return false;88 89 $to_send->plugins = $plugins;90 $to_send->active = $active;91 $send = serialize( $to_send );92 93 $request = 'plugins=' . urlencode( $send );94 $http_request = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";95 $http_request .= "Host: api.wordpress.org\r\n";96 $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";97 $http_request .= "Content-Length: " . strlen($request) . "\r\n";98 $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";99 $http_request .= "\r\n";100 $http_request .= $request;101 102 $response = '';103 if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {104 fwrite($fs, $http_request);105 106 while ( !feof($fs) )107 $response .= fgets($fs, 1160); // One TCP-IP packet108 fclose($fs);109 $response = explode("\r\n\r\n", $response, 2);110 }111 112 $response = unserialize( $response[1] );113 114 if ( $response )115 $new_option->response = $response;116 117 update_option( 'update_plugins', $new_option );118 }119 add_action( 'init', 'wp_update_plugins' );120 55 121 56 function wp_plugin_update_row( $file, $plugin_data ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)