Changeset 54997 for trunk/src/wp-admin/includes/update-core.php
- Timestamp:
- 12/15/2022 09:30:26 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/update-core.php
r54891 r54997 867 867 868 868 /** 869 * Stores Requests files to be preloaded and deleted. 870 * 871 * For classes/interfaces, use the class/interface name 872 * as the array key. 873 * 874 * All other files/directories should not have a key. 875 * 876 * @since 6.2.0 877 * 878 * @global array $_old_requests_files 879 * @var array 880 * @name $_old_requests_files 881 */ 882 global $_old_requests_files; 883 884 $_old_requests_files = array( 885 // Interfaces. 886 'Requests_Auth' => 'wp-includes/Requests/Auth.php', 887 'Requests_Hooker' => 'wp-includes/Requests/Hooker.php', 888 'Requests_Proxy' => 'wp-includes/Requests/Proxy.php', 889 'Requests_Transport' => 'wp-includes/Requests/Transport.php', 890 891 // Classes. 892 'Requests_Auth_Basic' => 'wp-includes/Requests/Auth/Basic.php', 893 'Requests_Cookie_Jar' => 'wp-includes/Requests/Cookie/Jar.php', 894 'Requests_Exception_HTTP' => 'wp-includes/Requests/Exception/HTTP.php', 895 'Requests_Exception_Transport' => 'wp-includes/Requests/Exception/Transport.php', 896 'Requests_Exception_HTTP_304' => 'wp-includes/Requests/Exception/HTTP/304.php', 897 'Requests_Exception_HTTP_305' => 'wp-includes/Requests/Exception/HTTP/305.php', 898 'Requests_Exception_HTTP_306' => 'wp-includes/Requests/Exception/HTTP/306.php', 899 'Requests_Exception_HTTP_400' => 'wp-includes/Requests/Exception/HTTP/400.php', 900 'Requests_Exception_HTTP_401' => 'wp-includes/Requests/Exception/HTTP/401.php', 901 'Requests_Exception_HTTP_402' => 'wp-includes/Requests/Exception/HTTP/402.php', 902 'Requests_Exception_HTTP_403' => 'wp-includes/Requests/Exception/HTTP/403.php', 903 'Requests_Exception_HTTP_404' => 'wp-includes/Requests/Exception/HTTP/404.php', 904 'Requests_Exception_HTTP_405' => 'wp-includes/Requests/Exception/HTTP/405.php', 905 'Requests_Exception_HTTP_406' => 'wp-includes/Requests/Exception/HTTP/406.php', 906 'Requests_Exception_HTTP_407' => 'wp-includes/Requests/Exception/HTTP/407.php', 907 'Requests_Exception_HTTP_408' => 'wp-includes/Requests/Exception/HTTP/408.php', 908 'Requests_Exception_HTTP_409' => 'wp-includes/Requests/Exception/HTTP/409.php', 909 'Requests_Exception_HTTP_410' => 'wp-includes/Requests/Exception/HTTP/410.php', 910 'Requests_Exception_HTTP_411' => 'wp-includes/Requests/Exception/HTTP/411.php', 911 'Requests_Exception_HTTP_412' => 'wp-includes/Requests/Exception/HTTP/412.php', 912 'Requests_Exception_HTTP_413' => 'wp-includes/Requests/Exception/HTTP/413.php', 913 'Requests_Exception_HTTP_414' => 'wp-includes/Requests/Exception/HTTP/414.php', 914 'Requests_Exception_HTTP_415' => 'wp-includes/Requests/Exception/HTTP/415.php', 915 'Requests_Exception_HTTP_416' => 'wp-includes/Requests/Exception/HTTP/416.php', 916 'Requests_Exception_HTTP_417' => 'wp-includes/Requests/Exception/HTTP/417.php', 917 'Requests_Exception_HTTP_418' => 'wp-includes/Requests/Exception/HTTP/418.php', 918 'Requests_Exception_HTTP_428' => 'wp-includes/Requests/Exception/HTTP/428.php', 919 'Requests_Exception_HTTP_429' => 'wp-includes/Requests/Exception/HTTP/429.php', 920 'Requests_Exception_HTTP_431' => 'wp-includes/Requests/Exception/HTTP/431.php', 921 'Requests_Exception_HTTP_500' => 'wp-includes/Requests/Exception/HTTP/500.php', 922 'Requests_Exception_HTTP_501' => 'wp-includes/Requests/Exception/HTTP/501.php', 923 'Requests_Exception_HTTP_502' => 'wp-includes/Requests/Exception/HTTP/502.php', 924 'Requests_Exception_HTTP_503' => 'wp-includes/Requests/Exception/HTTP/503.php', 925 'Requests_Exception_HTTP_504' => 'wp-includes/Requests/Exception/HTTP/504.php', 926 'Requests_Exception_HTTP_505' => 'wp-includes/Requests/Exception/HTTP/505.php', 927 'Requests_Exception_HTTP_511' => 'wp-includes/Requests/Exception/HTTP/511.php', 928 'Requests_Exception_HTTP_Unknown' => 'wp-includes/Requests/Exception/HTTP/Unknown.php', 929 'Requests_Exception_Transport_cURL' => 'wp-includes/Requests/Exception/Transport/cURL.php', 930 'Requests_Proxy_HTTP' => 'wp-includes/Requests/Proxy/HTTP.php', 931 'Requests_Response_Headers' => 'wp-includes/Requests/Response/Headers.php', 932 'Requests_Transport_cURL' => 'wp-includes/Requests/Transport/cURL.php', 933 'Requests_Transport_fsockopen' => 'wp-includes/Requests/Transport/fsockopen.php', 934 'Requests_Utility_CaseInsensitiveDictionary' => 'wp-includes/Requests/Utility/CaseInsensitiveDictionary.php', 935 'Requests_Utility_FilteredIterator' => 'wp-includes/Requests/Utility/FilteredIterator.php', 936 'Requests_Cookie' => 'wp-includes/Requests/Cookie.php', 937 'Requests_Exception' => 'wp-includes/Requests/Exception.php', 938 'Requests_Hooks' => 'wp-includes/Requests/Hooks.php', 939 'Requests_IDNAEncoder' => 'wp-includes/Requests/IDNAEncoder.php', 940 'Requests_IPv6' => 'wp-includes/Requests/IPv6.php', 941 'Requests_IRI' => 'wp-includes/Requests/IRI.php', 942 'Requests_Response' => 'wp-includes/Requests/Response.php', 943 'Requests_SSL' => 'wp-includes/Requests/SSL.php', 944 'Requests_Session' => 'wp-includes/Requests/Session.php', 945 946 // Directories. 947 'wp-includes/Requests/Auth/', 948 'wp-includes/Requests/Cookie/', 949 'wp-includes/Requests/Exception/HTTP/', 950 'wp-includes/Requests/Exception/Transport/', 951 'wp-includes/Requests/Exception/', 952 'wp-includes/Requests/Proxy/', 953 'wp-includes/Requests/Response/', 954 'wp-includes/Requests/Transport/', 955 'wp-includes/Requests/Utility/', 956 ); 957 958 /** 869 959 * Stores new files in wp-content to copy 870 960 * … … 950 1040 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. 951 1041 * @global array $_old_files 1042 * @global array $_old_requests_files 952 1043 * @global array $_new_bundled_files 953 1044 * @global wpdb $wpdb WordPress database abstraction object. … … 961 1052 */ 962 1053 function update_core( $from, $to ) { 963 global $wp_filesystem, $_old_files, $_ new_bundled_files, $wpdb;1054 global $wp_filesystem, $_old_files, $_old_requests_files, $_new_bundled_files, $wpdb; 964 1055 965 1056 set_time_limit( 300 ); 1057 1058 /* 1059 * Merge the old Requests files and directories into the `$_old_files`. 1060 * Then preload these Requests files first, before the files are deleted 1061 * and replaced to ensure the code is in memory if needed. 1062 */ 1063 $_old_files = array_merge( $_old_files, array_values( $_old_requests_files ) ); 1064 _preload_old_requests_classes_and_interfaces( $to ); 966 1065 967 1066 /** … … 1480 1579 1481 1580 /** 1581 * Preloads old Requests classes and interfaces. 1582 * 1583 * This function preloads the old Requests code into memory before the 1584 * upgrade process deletes the files. Why? Requests code is loaded into 1585 * memory via an autoloader, meaning when a class or interface is needed 1586 * If a request is in process, Requests could attempt to access code. If 1587 * the file is not there, a fatal error could occur. If the file was 1588 * replaced, the new code is not compatible with the old, resulting in 1589 * a fatal error. Preloading ensures the code is in memory before the 1590 * code is updated. 1591 * 1592 * @since 6.2.0 1593 * 1594 * @global array $_old_requests_files Requests files to be preloaded. 1595 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass. 1596 * 1597 * @param string $to Path to old WordPress installation. 1598 */ 1599 function _preload_old_requests_classes_and_interfaces( $to ) { 1600 global $_old_requests_files, $wp_filesystem; 1601 1602 foreach ( $_old_requests_files as $name => $file ) { 1603 // Skip files that aren't interfaces or classes. 1604 if ( is_int( $name ) ) { 1605 continue; 1606 } 1607 1608 // Skip if it's already loaded. 1609 if ( class_exists( $name ) || interface_exists( $name ) ) { 1610 continue; 1611 } 1612 1613 // Skip if the file is missing. 1614 if ( ! $wp_filesystem->is_file( $to . $file ) ) { 1615 continue; 1616 } 1617 1618 require_once $to . $file; 1619 } 1620 } 1621 1622 /** 1482 1623 * Redirect to the About WordPress page after a successful upgrade. 1483 1624 *
Note: See TracChangeset
for help on using the changeset viewer.