Changeset 30384 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 11/19/2014 05:39:52 AM (11 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/includes/class-wp-upgrader.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r30171 r30384 62 62 } 63 63 64 public function fs_connect( $directories = array() ) {64 public function fs_connect( $directories = array(), $allow_relaxed_file_ownership = false ) { 65 65 global $wp_filesystem; 66 66 67 if ( false === ( $credentials = $this->skin->request_filesystem_credentials()) )67 if ( false === ( $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ) ) ) { 68 68 return false; 69 70 if ( ! WP_Filesystem($credentials) ) { 69 } 70 71 if ( ! WP_Filesystem( $credentials, $directories[0], $allow_relaxed_file_ownership ) ) { 71 72 $error = true; 72 73 if ( is_object($wp_filesystem) && $wp_filesystem->errors->get_error_code() ) 73 74 $error = $wp_filesystem->errors; 74 $this->skin->request_filesystem_credentials($error); //Failed to connect, Error and request again 75 // Failed to connect, Error and request again 76 $this->skin->request_filesystem_credentials( $error, $directories[0], $allow_relaxed_file_ownership ); 75 77 return false; 76 78 } … … 1457 1459 'attempt_rollback' => false, 1458 1460 'do_rollback' => false, 1461 'allow_relaxed_file_ownership' => false, 1459 1462 ); 1460 1463 $parsed_args = wp_parse_args( $args, $defaults ); … … 1467 1470 return new WP_Error('up_to_date', $this->strings['up_to_date']); 1468 1471 1469 $res = $this->fs_connect( array( ABSPATH, WP_CONTENT_DIR));1472 $res = $this->fs_connect( array( ABSPATH, WP_CONTENT_DIR ), $parsed_args['allow_relaxed_file_ownership'] ); 1470 1473 if ( ! $res || is_wp_error( $res ) ) { 1471 1474 return $res; … … 1912 1915 return false; 1913 1916 1917 // Only relax the filesystem checks when the update doesn't include new files 1918 $allow_relaxed_file_ownership = false; 1919 if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) { 1920 $allow_relaxed_file_ownership = true; 1921 } 1922 1914 1923 // If we can't do an auto core update, we may still be able to email the user. 1915 if ( ! $skin->request_filesystem_credentials( false, $context ) || $this->is_vcs_checkout( $context ) ) {1924 if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) || $this->is_vcs_checkout( $context ) ) { 1916 1925 if ( 'core' == $type ) 1917 1926 $this->send_core_update_notification_email( $item ); … … 2073 2082 } 2074 2083 2084 $allow_relaxed_file_ownership = false; 2085 if ( 'core' == $type && isset( $item->new_files ) && ! $item->new_files ) { 2086 $allow_relaxed_file_ownership = true; 2087 } 2088 2075 2089 // Boom, This sites about to get a whole new splash of paint! 2076 2090 $upgrade_result = $upgrader->upgrade( $upgrader_item, array( … … 2080 2094 // Only available for core updates. 2081 2095 'attempt_rollback' => true, 2096 // Allow relaxed file ownership in some scenarios 2097 'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership, 2098 2082 2099 ) ); 2083 2100
Note: See TracChangeset
for help on using the changeset viewer.