Changeset 29206 for trunk/src/wp-admin/includes/class-wp-upgrader.php
- Timestamp:
- 07/17/2014 09:13:53 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-upgrader.php
r28956 r29206 191 191 192 192 $args = wp_parse_args($args, $defaults); 193 // these were previously extract()'d 193 194 // These were previously extract()'d. 194 195 $source = $args['source']; 195 196 $destination = $args['destination']; … … 250 251 } 251 252 252 // Has the source location changed? If so, we need a new source_files list.253 // Has the source location changed? If so, we need a new source_files list. 253 254 if ( $source !== $remote_source ) { 254 255 $source_files = array_keys( $wp_filesystem->dirlist( $source ) ); 255 256 } 256 // Protection against deleting files in any important base directories. 257 // Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the destination directory (WP_PLUGIN_DIR / wp-content/themes) 258 // intending to copy the directory into the directory, whilst they pass the source as the actual files to copy. 257 /* 258 * Protection against deleting files in any important base directories. 259 * Theme_Upgrader & Plugin_Upgrader also trigger this, as they pass the 260 * destination directory (WP_PLUGIN_DIR / wp-content/themes) intending 261 * to copy the directory into the directory, whilst they pass the source 262 * as the actual files to copy. 263 */ 259 264 $protected_directories = array( ABSPATH, WP_CONTENT_DIR, WP_PLUGIN_DIR, WP_CONTENT_DIR . '/themes' ); 265 260 266 if ( is_array( $wp_theme_directories ) ) { 261 267 $protected_directories = array_merge( $protected_directories, $wp_theme_directories ); … … 717 723 } 718 724 719 // return plugin info.725 // Return plugin info. 720 726 public function plugin_info() { 721 727 if ( ! is_array($this->result) ) … … 1267 1273 $this->update_current = 0; 1268 1274 1269 // The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists, 1270 // as we then may need to create a /plugins or /themes directory inside of it. 1275 /* 1276 * The filesystem's mkdir() is not recursive. Make sure WP_LANG_DIR exists, 1277 * as we then may need to create a /plugins or /themes directory inside of it. 1278 */ 1271 1279 $remote_destination = $wp_filesystem->find_folder( WP_LANG_DIR ); 1272 1280 if ( ! $wp_filesystem->exists( $remote_destination ) ) … … 1470 1478 if ( is_wp_error( $result ) ) { 1471 1479 $error_code = $result->get_error_code(); 1472 // Not all errors are equal. These codes are critical: copy_failed__copy_dir, 1473 // mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full. 1474 // do_rollback allows for update_core() to trigger a rollback if needed. 1480 /* 1481 * Not all errors are equal. These codes are critical: copy_failed__copy_dir, 1482 * mkdir_failed__copy_dir, copy_failed__copy_dir_retry, and disk_full. 1483 * do_rollback allows for update_core() to trigger a rollback if needed. 1484 */ 1475 1485 if ( false !== strpos( $error_code, 'do_rollback' ) ) 1476 1486 $try_rollback = true; … … 1602 1612 if ( ! apply_filters( 'allow_dev_auto_core_updates', $upgrade_dev ) ) 1603 1613 return false; 1604 // else fall through to minor + major branches below1614 // Else fall through to minor + major branches below. 1605 1615 } 1606 1616 … … 1693 1703 ); 1694 1704 1695 // Save the data 1705 // Save the data. 1696 1706 $this->id = wp_insert_attachment( $object, $file['file'] ); 1697 1707 1698 // schedule a cleanup for 2 hours from now in case of failed install1708 // Schedule a cleanup for 2 hours from now in case of failed install. 1699 1709 wp_schedule_single_event( time() + 2 * HOUR_IN_SECONDS, 'upgrader_scheduled_cleanup', array( $this->id ) ); 1700 1710 … … 2019 2029 $upgrade_result = $upgrader->upgrade( $upgrader_item, array( 2020 2030 'clear_update_cache' => false, 2021 'pre_check_md5' => false, /* always use partial builds if possible for core updates */ 2022 'attempt_rollback' => true, /* only available for core updates */ 2031 // Always use partial builds if possible for core updates. 2032 'pre_check_md5' => false, 2033 // Only available for core updates. 2034 'attempt_rollback' => true, 2023 2035 ) ); 2024 2036 2025 // if the filesystem is unavailable, false is returned.2037 // If the filesystem is unavailable, false is returned. 2026 2038 if ( false === $upgrade_result ) { 2027 2039 $upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); 2028 2040 } 2029 2041 2030 // Core doesn't output this, so lets append it so we don't get confused 2042 // Core doesn't output this, so lets append it so we don't get confused. 2031 2043 if ( 'core' == $type ) { 2032 2044 if ( is_wp_error( $upgrade_result ) ) {
Note: See TracChangeset
for help on using the changeset viewer.