Changeset 25777 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 10/14/2013 09:02:46 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r25770 r25777 160 160 161 161 // Unzip package to working directory 162 $result = unzip_file( $package, $working_dir); //TODO optimizations, Copy when Move/Rename would suffice?162 $result = unzip_file( $package, $working_dir ); 163 163 164 164 // Once extracted, delete the package if required. … … 1299 1299 $result = update_core( $working_dir, $wp_dir ); 1300 1300 1301 // In the event of an error, rollback to the previous version 1302 if ( is_wp_error( $result ) && $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) { 1303 apply_filters( 'update_feedback', $result ); 1304 apply_filters( 'update_feedback', $this->strings['start_rollback'] ); 1305 1306 $rollback_result = $this->upgrade( $current, array_merge( $parsed_args, array( 'do_rollback' => true ) ) ); 1307 1308 $result = new WP_Error( 'rollback_was_required', $this->strings['rollback_was_required'], array( 'rollback' => $rollback_result, 'update' => $result ) ); 1309 } 1301 // In the event of an issue, we may be able to roll back. 1302 if ( $parsed_args['attempt_rollback'] && $current->packages->rollback && ! $parsed_args['do_rollback'] ) { 1303 $try_rollback = false; 1304 if ( is_wp_error( $result ) ) { 1305 $error_code = $result->get_error_code(); 1306 // Not all errors are equal. These codes are critical: copy_failed__copy_dir, 1307 // mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full. 1308 if ( false !== strpos( $error_code, '__copy_dir' ) ) 1309 $try_rollback = true; 1310 elseif ( 'disk_full' === $error_code ) 1311 $try_rollback = true; 1312 } 1313 1314 if ( $try_rollback ) { 1315 apply_filters( 'update_feedback', $result ); 1316 apply_filters( 'update_feedback', $this->strings['start_rollback'] ); 1317 1318 $rollback_result = $this->upgrade( $current, array_merge( $parsed_args, array( 'do_rollback' => true ) ) ); 1319 1320 $result = new WP_Error( 'rollback_was_required', $this->strings['rollback_was_required'], array( 'rollback' => $rollback_result, 'update' => $result ) ); 1321 } 1322 } 1323 1310 1324 do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ), $result ); 1311 1325 return $result;
Note: See TracChangeset
for help on using the changeset viewer.