Ticket #10205: 10205.2.diff
File 10205.2.diff, 5.4 KB (added by , 11 years ago) |
---|
-
src/wp-admin/includes/class-wp-upgrader.php
1074 1074 global $wp_filesystem, $wp_version; 1075 1075 1076 1076 $defaults = array( 1077 'to_download' => 'full', 1077 1078 ); 1078 1079 $parsed_args = wp_parse_args( $defaults, $args ); 1079 1080 … … 1090 1091 1091 1092 $wp_dir = trailingslashit($wp_filesystem->abspath()); 1092 1093 1093 // If partial update is returned from the API, use that, unless we're doing a reinstall. 1094 // If we cross the new_bundled version number, then use the new_bundled zip. 1095 // Don't though if the constant is set to skip bundled items. 1096 // If the API returns a no_content zip, go with it. Finally, default to the full zip. 1097 if ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version ) 1098 $to_download = 'partial'; 1099 elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) 1100 && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) 1101 $to_download = 'new_bundled'; 1102 elseif ( $current->packages->no_content ) 1103 $to_download = 'no_content'; 1104 else 1105 $to_download = 'full'; 1106 1107 $download = $this->download_package( $current->packages->$to_download ); 1094 $download = $this->download_package( $update->packages->{$parsed_args['to_download']} ); 1108 1095 if ( is_wp_error($download) ) 1109 1096 return $download; 1110 1097 -
src/wp-admin/includes/file.php
833 833 function get_filesystem_method($args = array(), $context = false) { 834 834 $method = defined('FS_METHOD') ? FS_METHOD : false; //Please ensure that this is either 'direct', 'ssh', 'ftpext' or 'ftpsockets' 835 835 836 if ( ! $context ) 837 $context = WP_CONTENT_DIR; 838 836 839 if ( ! $method && function_exists('getmyuid') && function_exists('fileowner') ){ 837 if ( !$context )838 $context = WP_CONTENT_DIR;839 840 $context = trailingslashit($context); 840 841 $temp_file_name = $context . 'temp-write-test-' . time(); 841 842 $temp_handle = @fopen($temp_file_name, 'w'); … … 847 848 } 848 849 } 849 850 851 // If group-writable is OK, check that the current file, and the destination( $context ) is writable. 852 // Group-writable is only enabled for Partial Core Upgrades at present due to them only modifying changed files, not creating new files 853 if ( ! $method && !empty( $args['allow_group_writable'] ) && is_writable( $context ) && is_writable( __FILE__ ) ) 854 $method = 'direct'; 855 850 856 if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2'; 851 857 if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext'; 852 858 if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread -
src/wp-admin/update-core.php
314 314 function do_core_upgrade( $reinstall = false ) { 315 315 global $wp_filesystem; 316 316 317 include ABSPATH . WPINC . '/version.php'; // $wp_version 317 318 include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; 318 319 319 320 if ( $reinstall ) … … 327 328 $version = isset( $_POST['version'] )? $_POST['version'] : false; 328 329 $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US'; 329 330 $update = find_core_update( $version, $locale ); 330 if ( !$update ) 331 332 if ( !$update || !isset( $update->response ) ) 331 333 return; 332 334 333 if ( ! WP_Filesystem($credentials, ABSPATH) ) { 335 if ( $reinstall ) 336 $update->response = 'reinstall'; 337 338 if ( $update->response == 'latest' ) 339 return; 340 341 // If partial update is returned from the API, use that, unless we're doing a reinstall. 342 // If we cross the new_bundled version number, then use the new_bundled zip. 343 // Don't though if the constant is set to skip bundled items. 344 // If the API returns a no_content zip, go with it. Finally, default to the full zip. 345 if ( $update->packages->partial && ! $reinstall && $wp_version == $update->partial_version ) 346 $to_download = 'partial'; 347 elseif ( $update->packages->new_bundled && version_compare( $wp_version, $update->new_bundled, '<' ) 348 && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) 349 $to_download = 'new_bundled'; 350 elseif ( $update->packages->no_content ) 351 $to_download = 'no_content'; 352 else 353 $to_download = 'full'; 354 355 $credentials['allow_group_writable'] = ( 'partial' == $to_download ); 356 357 if ( ! WP_Filesystem( $credentials, ABSPATH ) ) { 334 358 request_filesystem_credentials($url, '', true, ABSPATH); //Failed to connect, Error and request again 335 359 return; 336 360 } … … 346 370 return; 347 371 } 348 372 349 if ( $reinstall ) 350 $update->response = 'reinstall'; 373 $args = array( 374 'to_download' => $to_download, 375 ); 351 376 352 377 add_filter( 'update_feedback', 'show_message' ); 353 378 354 379 $upgrader = new Core_Upgrader(); 355 $result = $upgrader->upgrade( $update );380 $result = $upgrader->upgrade( $update, $args ); 356 381 357 382 if ( is_wp_error($result) ) { 358 383 show_message($result);