Changeset 47122 for trunk/src/wp-admin/includes/update-core.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/update-core.php
r47099 r47122 254 254 'wp-includes/js/jquery/interface.js', 255 255 'wp-includes/js/scriptaculous/prototype.js', 256 // Following file added back in 5.1 see #45645256 // Following file added back in 5.1, see #45645. 257 257 //'wp-includes/js/tinymce/wp-tinymce.js', 258 258 // 3.1 … … 537 537 'wp-admin/images/screenshots/twitter-embed-2.png', 538 538 'wp-admin/js/utils.js', 539 // Added back in 5.3 [45448], see #43895 539 // Added back in 5.3 [45448], see #43895. 540 540 // 'wp-admin/options-privacy.php', 541 541 'wp-app.php', … … 601 601 'wp-admin/css/colors-rtl.css', 602 602 'wp-admin/css/colors-rtl.min.css', 603 // Following files added back in 4.5 see #36083603 // Following files added back in 4.5, see #36083. 604 604 // 'wp-admin/css/media-rtl.min.css', 605 605 // 'wp-admin/css/media.min.css', … … 616 616 'wp-includes/js/plupload/plupload.silverlight.js', 617 617 'wp-includes/js/plupload/plupload.flash.js', 618 // Added back in 4.9 [41328], see #41755 618 // Added back in 4.9 [41328], see #41755. 619 619 // 'wp-includes/js/plupload/plupload.js', 620 620 'wp-includes/js/tinymce/plugins/spellchecker', … … 788 788 'wp-includes/js/tinymce/wp-tinymce.js.gz', 789 789 // 5.3 790 'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js790 'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js 791 791 'wp-includes/js/wp-a11y.min.js', // Moved to: wp-includes/js/dist/a11y.min.js 792 792 ); … … 939 939 $php_version = phpversion(); 940 940 $mysql_version = $wpdb->db_version(); 941 $old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from 942 $development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // a dash in the version indicates a Development release941 $old_wp_version = $GLOBALS['wp_version']; // The version of WordPress we're updating from. 942 $development_build = ( false !== strpos( $old_wp_version . $wp_version, '-' ) ); // A dash in the version indicates a development release. 943 943 $php_compat = version_compare( $php_version, $required_php_version, '>=' ); 944 944 if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { … … 1018 1018 apply_filters( 'update_feedback', __( 'Preparing to install the latest version…' ) ); 1019 1019 1020 // Don't copy wp-content, we'll deal with that below 1021 // We also copy version.php last so failed updates report their old version 1020 // Don't copy wp-content, we'll deal with that below. 1021 // We also copy version.php last so failed updates report their old version. 1022 1022 $skip = array( 'wp-content', 'wp-includes/version.php' ); 1023 1023 $check_is_writable = array(); 1024 1024 1025 // Check to see which files don't really need updating - only available for 3.7 and higher 1025 // Check to see which files don't really need updating - only available for 3.7 and higher. 1026 1026 if ( function_exists( 'get_core_checksums' ) ) { 1027 // Find the local version of the working directory 1027 // Find the local version of the working directory. 1028 1028 $working_dir_local = WP_CONTENT_DIR . '/upgrade/' . basename( $from ) . $distro; 1029 1029 1030 1030 $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); 1031 1031 if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) { 1032 $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2 1032 $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2. 1033 1033 } 1034 1034 if ( is_array( $checksums ) ) { … … 1079 1079 /** This filter is documented in wp-admin/includes/update-core.php */ 1080 1080 apply_filters( 'update_feedback', __( 'Enabling Maintenance mode…' ) ); 1081 // Create maintenance file to signal that we are upgrading 1081 // Create maintenance file to signal that we are upgrading. 1082 1082 $maintenance_string = '<?php $upgrading = ' . time() . '; ?>'; 1083 1083 $maintenance_file = $to . '.maintenance'; … … 1093 1093 } 1094 1094 1095 // Since we know the core files have copied over, we can now copy the version file 1095 // Since we know the core files have copied over, we can now copy the version file. 1096 1096 if ( ! is_wp_error( $result ) ) { 1097 1097 if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $to . 'wp-includes/version.php', true /* overwrite */ ) ) { … … 1102 1102 } 1103 1103 1104 // Check to make sure everything copied correctly, ignoring the contents of wp-content 1104 // Check to make sure everything copied correctly, ignoring the contents of wp-content. 1105 1105 $skip = array( 'wp-content' ); 1106 1106 $failed = array(); … … 1125 1125 } 1126 1126 1127 // Some files didn't copy properly 1127 // Some files didn't copy properly. 1128 1128 if ( ! empty( $failed ) ) { 1129 1129 $total_size = 0; … … 1147 1147 } 1148 1148 1149 // Custom Content Directory needs updating now.1150 // Copy Languages1149 // Custom content directory needs updating now. 1150 // Copy languages. 1151 1151 if ( ! is_wp_error( $result ) && $wp_filesystem->is_dir( $from . $distro . 'wp-content/languages' ) ) { 1152 1152 if ( WP_LANG_DIR != ABSPATH . WPINC . '/languages' || @is_dir( WP_LANG_DIR ) ) { … … 1156 1156 } 1157 1157 1158 if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) { // Check the language directory exists first 1159 $wp_filesystem->mkdir( $to . str_replace( ABSPATH, '', $lang_dir ), FS_CHMOD_DIR ); // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. 1160 clearstatcache(); // for FTP, Need to clear the stat cache 1158 // Check if the language directory exists first. 1159 if ( ! @is_dir( $lang_dir ) && 0 === strpos( $lang_dir, ABSPATH ) ) { 1160 // If it's within the ABSPATH we can handle it here, otherwise they're out of luck. 1161 $wp_filesystem->mkdir( $to . str_replace( ABSPATH, '', $lang_dir ), FS_CHMOD_DIR ); 1162 clearstatcache(); // For FTP, need to clear the stat cache. 1161 1163 } 1162 1164 … … 1174 1176 /** This filter is documented in wp-admin/includes/update-core.php */ 1175 1177 apply_filters( 'update_feedback', __( 'Disabling Maintenance mode…' ) ); 1176 // Remove maintenance file, we're done with potential site-breaking changes 1178 // Remove maintenance file, we're done with potential site-breaking changes. 1177 1179 $wp_filesystem->delete( $maintenance_file ); 1178 1180 … … 1184 1186 } 1185 1187 1186 // Copy New bundled plugins & themes 1187 // This gives us the ability to install new plugins & themes bundled with future versions of WordPress whilst avoiding the re-install upon upgrade issue. 1188 // $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated 1188 /* 1189 * Copy new bundled plugins & themes. 1190 * This gives us the ability to install new plugins & themes bundled with 1191 * future versions of WordPress whilst avoiding the re-install upon upgrade issue. 1192 * $development_build controls us overwriting bundled themes and plugins when a non-stable release is being updated. 1193 */ 1189 1194 if ( ! is_wp_error( $result ) && ( ! defined( 'CORE_UPGRADE_SKIP_NEW_BUNDLED' ) || ! CORE_UPGRADE_SKIP_NEW_BUNDLED ) ) { 1190 1195 foreach ( (array) $_new_bundled_files as $file => $introduced_version ) { 1191 // If a $development_build or if $introduced version is greater than what the site was previously running 1196 // If a $development_build or if $introduced version is greater than what the site was previously running. 1192 1197 if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) { 1193 1198 $directory = ( '/' == $file[ strlen( $file ) - 1 ] ); 1194 1199 list($type, $filename) = explode( '/', $file, 2 ); 1195 1200 1196 // Check to see if the bundled items exist before attempting to copy them 1201 // Check to see if the bundled items exist before attempting to copy them. 1197 1202 if ( ! $wp_filesystem->exists( $from . $distro . 'wp-content/' . $file ) ) { 1198 1203 continue; … … 1202 1207 $dest = $wp_filesystem->wp_plugins_dir(); 1203 1208 } elseif ( 'themes' == $type ) { 1204 $dest = trailingslashit( $wp_filesystem->wp_themes_dir() ); // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2 1209 // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2. 1210 $dest = trailingslashit( $wp_filesystem->wp_themes_dir() ); 1205 1211 } else { 1206 1212 continue; … … 1232 1238 } 1233 1239 } 1234 } // end foreach1235 } 1236 1237 // Handle $result error from the above blocks 1240 } // End foreach. 1241 } 1242 1243 // Handle $result error from the above blocks. 1238 1244 if ( is_wp_error( $result ) ) { 1239 1245 $wp_filesystem->delete( $from, true ); … … 1241 1247 } 1242 1248 1243 // Remove old files 1249 // Remove old files. 1244 1250 foreach ( $_old_files as $old_file ) { 1245 1251 $old_file = $to . $old_file; … … 1254 1260 } 1255 1261 1256 // Remove any Genericons example.html's from the filesystem 1262 // Remove any Genericons example.html's from the filesystem. 1257 1263 _upgrade_422_remove_genericons(); 1258 1264 1259 // Remove the REST API plugin if its version is Beta 4 or lower 1265 // Remove the REST API plugin if its version is Beta 4 or lower. 1260 1266 _upgrade_440_force_deactivate_incompatible_plugins(); 1261 1267 1262 // Upgrade DB with separate request 1268 // Upgrade DB with separate request. 1263 1269 /** This filter is documented in wp-admin/includes/update-core.php */ 1264 1270 apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); … … 1266 1272 wp_remote_post( $db_upgrade_url, array( 'timeout' => 60 ) ); 1267 1273 1268 // Clear the cache to prevent an update_option() from saving a stale db_version to the cache 1274 // Clear the cache to prevent an update_option() from saving a stale db_version to the cache. 1269 1275 wp_cache_flush(); 1270 // (Not all cache back ends listen to 'flush')1276 // Not all cache back ends listen to 'flush'. 1271 1277 wp_cache_delete( 'alloptions', 'options' ); 1272 1278 1273 // Remove working directory 1279 // Remove working directory. 1274 1280 $wp_filesystem->delete( $from, true ); 1275 1281 1276 // Force refresh of update information 1282 // Force refresh of update information. 1277 1283 if ( function_exists( 'delete_site_transient' ) ) { 1278 1284 delete_site_transient( 'update_core' ); … … 1397 1403 load_default_textdomain(); 1398 1404 1399 // See do_core_upgrade() 1405 // See do_core_upgrade(). 1400 1406 show_message( __( 'WordPress updated successfully' ) ); 1401 1407 … … 1443 1449 $affected_files = array(); 1444 1450 1445 // Themes 1451 // Themes. 1446 1452 foreach ( $wp_theme_directories as $directory ) { 1447 1453 $affected_theme_files = _upgrade_422_find_genericons_files_in_folder( $directory ); … … 1449 1455 } 1450 1456 1451 // Plugins 1457 // Plugins. 1452 1458 $affected_plugin_files = _upgrade_422_find_genericons_files_in_folder( WP_PLUGIN_DIR ); 1453 1459 $affected_files = array_merge( $affected_files, $affected_plugin_files ); … … 1459 1465 } 1460 1466 1461 // The path when the file is accessed via WP_Filesystem may differ in the case of FTP 1467 // The path when the file is accessed via WP_Filesystem may differ in the case of FTP. 1462 1468 $remote_file = $gen_dir . basename( $file ); 1463 1469
Note: See TracChangeset
for help on using the changeset viewer.