Changeset 25649 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 09/30/2013 12:20:35 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r25648 r25649 1225 1225 $this->strings['copy_failed'] = __('Could not copy files.'); 1226 1226 $this->strings['copy_failed_space'] = __('Could not copy files. You may have run out of disk space.' ); 1227 $this->strings['start_rollback'] = __( 'Attempting to rollback to previous version.' ); 1228 $this->strings['rollback_was_required'] = __( 'Due to an error during updating, WordPress has rolled back to your previous version' ); 1227 1229 } 1228 1230 … … 1231 1233 1232 1234 $defaults = array( 1233 'pre_check_md5' => true, 1235 'pre_check_md5' => true, 1236 'attempt_rollback' => false, 1237 'do_rollback' => false, 1234 1238 ); 1235 1239 $parsed_args = wp_parse_args( $args, $defaults ); … … 1252 1256 1253 1257 $no_partial = false; 1254 if ( $parsed_args['pre_check_md5'] && ! $this->check_files() ) 1258 if ( $parsed_args['do_rollback'] ) 1259 $no_partial = true; 1260 elseif ( $parsed_args['pre_check_md5'] && ! $this->check_files() ) 1255 1261 $no_partial = true; 1256 1262 … … 1259 1265 // Don't though if the constant is set to skip bundled items. 1260 1266 // If the API returns a no_content zip, go with it. Finally, default to the full zip. 1261 if ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && ! $no_partial ) 1267 if ( $parsed_args['do_rollback'] && $current->packages->rollback ) 1268 $to_download = 'rollback'; 1269 elseif ( $current->packages->partial && 'reinstall' != $current->response && $wp_version == $current->partial_version && ! $no_partial ) 1262 1270 $to_download = 'partial'; 1263 1271 elseif ( $current->packages->new_bundled && version_compare( $wp_version, $current->new_bundled, '<' ) … … 1284 1292 $wp_filesystem->chmod($wp_dir . 'wp-admin/includes/update-core.php', FS_CHMOD_FILE); 1285 1293 1286 require (ABSPATH . 'wp-admin/includes/update-core.php');1294 require_once( ABSPATH . 'wp-admin/includes/update-core.php' ); 1287 1295 1288 1296 if ( ! function_exists( 'update_core' ) ) 1289 1297 return new WP_Error( 'copy_failed_space', $this->strings['copy_failed_space'] ); 1290 1298 1291 $result = update_core( $working_dir, $wp_dir ); 1299 $result = update_core( $working_dir, $wp_dir, $parsed_args['do_rollback'] ); 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 ) { 1303 apply_filters( 'update_feedback', $result ); 1304 apply_filters( 'update_feedback', $this->strings['start_rollback'] ); 1305 1306 $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'] ); 1309 } 1292 1310 do_action( 'upgrader_process_complete', $this, array( 'action' => 'update', 'type' => 'core' ), $result ); 1293 1311 return $result; … … 1631 1649 'clear_update_cache' => false, 1632 1650 'pre_check_md5' => false, /* always use partial builds if possible for core updates */ 1651 'attempt_rollback' => true, /* only available for core updates */ 1633 1652 ) ); 1634 1653
Note: See TracChangeset
for help on using the changeset viewer.