596 // 3.9 |
596 // 3.9 |
597 'wp-admin/css/colors.css', |
597 'wp-admin/css/colors.css', |
598 'wp-admin/css/colors.min.css', |
598 'wp-admin/css/colors.min.css', |
599 'wp-admin/css/colors-rtl.css', |
599 'wp-admin/css/colors-rtl.css', |
600 'wp-admin/css/colors-rtl.min.css', |
600 'wp-admin/css/colors-rtl.min.css', |
601 'wp-admin/css/media-rtl.min.css', |
601 // Following files added back in 4.5 see #36083 |
602 'wp-admin/css/media.min.css', |
602 // 'wp-admin/css/media-rtl.min.css', |
603 'wp-admin/css/farbtastic-rtl.min.css', |
603 // 'wp-admin/css/media.min.css', |
|
604 // 'wp-admin/css/farbtastic-rtl.min.css', |
604 'wp-admin/images/lock-2x.png', |
605 'wp-admin/images/lock-2x.png', |
605 'wp-admin/images/lock.png', |
606 'wp-admin/images/lock.png', |
606 'wp-admin/js/theme-preview.js', |
607 'wp-admin/js/theme-preview.js', |
607 'wp-admin/js/theme-install.min.js', |
608 'wp-admin/js/theme-install.min.js', |
608 'wp-admin/js/theme-install.js', |
609 'wp-admin/js/theme-install.js', |
610 'wp-includes/js/plupload/plupload.html4.js', |
611 'wp-includes/js/plupload/plupload.html4.js', |
611 'wp-includes/js/plupload/plupload.html5.js', |
612 'wp-includes/js/plupload/plupload.html5.js', |
612 'wp-includes/js/plupload/changelog.txt', |
613 'wp-includes/js/plupload/changelog.txt', |
613 'wp-includes/js/plupload/plupload.silverlight.js', |
614 'wp-includes/js/plupload/plupload.silverlight.js', |
614 'wp-includes/js/plupload/plupload.flash.js', |
615 'wp-includes/js/plupload/plupload.flash.js', |
615 'wp-includes/js/plupload/plupload.js', |
616 // Added back in 4.9 [41328], see #41755 |
|
617 // 'wp-includes/js/plupload/plupload.js', |
616 'wp-includes/js/tinymce/plugins/spellchecker', |
618 'wp-includes/js/tinymce/plugins/spellchecker', |
617 'wp-includes/js/tinymce/plugins/inlinepopups', |
619 'wp-includes/js/tinymce/plugins/inlinepopups', |
618 'wp-includes/js/tinymce/plugins/media/js', |
620 'wp-includes/js/tinymce/plugins/media/js', |
619 'wp-includes/js/tinymce/plugins/media/css', |
621 'wp-includes/js/tinymce/plugins/media/css', |
620 'wp-includes/js/tinymce/plugins/wordpress/img', |
622 'wp-includes/js/tinymce/plugins/wordpress/img', |
692 'wp-includes/js/jquery/ui/jquery.ui.sortable.min.js', |
694 'wp-includes/js/jquery/ui/jquery.ui.sortable.min.js', |
693 'wp-includes/js/jquery/ui/jquery.ui.spinner.min.js', |
695 'wp-includes/js/jquery/ui/jquery.ui.spinner.min.js', |
694 'wp-includes/js/jquery/ui/jquery.ui.tabs.min.js', |
696 'wp-includes/js/jquery/ui/jquery.ui.tabs.min.js', |
695 'wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js', |
697 'wp-includes/js/jquery/ui/jquery.ui.tooltip.min.js', |
696 'wp-includes/js/jquery/ui/jquery.ui.widget.min.js', |
698 'wp-includes/js/jquery/ui/jquery.ui.widget.min.js', |
697 'wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png' |
699 'wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png', |
|
700 // 4.3 |
|
701 'wp-admin/js/wp-fullscreen.js', |
|
702 'wp-admin/js/wp-fullscreen.min.js', |
|
703 'wp-includes/js/tinymce/wp-mce-help.php', |
|
704 'wp-includes/js/tinymce/plugins/wpfullscreen', |
|
705 // 4.5 |
|
706 'wp-includes/theme-compat/comments-popup.php', |
|
707 // 4.6 |
|
708 'wp-admin/includes/class-wp-automatic-upgrader.php', // Wrong file name, see #37628. |
|
709 // 4.8 |
|
710 'wp-includes/js/tinymce/plugins/wpembed', |
|
711 'wp-includes/js/tinymce/plugins/media/moxieplayer.swf', |
|
712 'wp-includes/js/tinymce/skins/lightgray/fonts/readme.md', |
|
713 'wp-includes/js/tinymce/skins/lightgray/fonts/tinymce-small.json', |
|
714 'wp-includes/js/tinymce/skins/lightgray/fonts/tinymce.json', |
|
715 'wp-includes/js/tinymce/skins/lightgray/skin.ie7.min.css', |
|
716 // 4.9 |
|
717 'wp-admin/css/press-this-editor-rtl.css', |
|
718 'wp-admin/css/press-this-editor-rtl.min.css', |
|
719 'wp-admin/css/press-this-editor.css', |
|
720 'wp-admin/css/press-this-editor.min.css', |
|
721 'wp-admin/css/press-this-rtl.css', |
|
722 'wp-admin/css/press-this-rtl.min.css', |
|
723 'wp-admin/css/press-this.css', |
|
724 'wp-admin/css/press-this.min.css', |
|
725 'wp-admin/includes/class-wp-press-this.php', |
|
726 'wp-admin/js/bookmarklet.js', |
|
727 'wp-admin/js/bookmarklet.min.js', |
|
728 'wp-admin/js/press-this.js', |
|
729 'wp-admin/js/press-this.min.js', |
|
730 'wp-includes/js/mediaelement/background.png', |
|
731 'wp-includes/js/mediaelement/bigplay.png', |
|
732 'wp-includes/js/mediaelement/bigplay.svg', |
|
733 'wp-includes/js/mediaelement/controls.png', |
|
734 'wp-includes/js/mediaelement/controls.svg', |
|
735 'wp-includes/js/mediaelement/flashmediaelement.swf', |
|
736 'wp-includes/js/mediaelement/froogaloop.min.js', |
|
737 'wp-includes/js/mediaelement/jumpforward.png', |
|
738 'wp-includes/js/mediaelement/loading.gif', |
|
739 'wp-includes/js/mediaelement/silverlightmediaelement.xap', |
|
740 'wp-includes/js/mediaelement/skipback.png', |
|
741 'wp-includes/js/plupload/plupload.flash.swf', |
|
742 'wp-includes/js/plupload/plupload.full.min.js', |
|
743 'wp-includes/js/plupload/plupload.silverlight.xap', |
|
744 'wp-includes/js/swfupload/plugins', |
|
745 'wp-includes/js/swfupload/swfupload.swf', |
|
746 // 4.9.2 |
|
747 'wp-includes/js/mediaelement/lang', |
|
748 'wp-includes/js/mediaelement/lang/ca.js', |
|
749 'wp-includes/js/mediaelement/lang/cs.js', |
|
750 'wp-includes/js/mediaelement/lang/de.js', |
|
751 'wp-includes/js/mediaelement/lang/es.js', |
|
752 'wp-includes/js/mediaelement/lang/fa.js', |
|
753 'wp-includes/js/mediaelement/lang/fr.js', |
|
754 'wp-includes/js/mediaelement/lang/hr.js', |
|
755 'wp-includes/js/mediaelement/lang/hu.js', |
|
756 'wp-includes/js/mediaelement/lang/it.js', |
|
757 'wp-includes/js/mediaelement/lang/ja.js', |
|
758 'wp-includes/js/mediaelement/lang/ko.js', |
|
759 'wp-includes/js/mediaelement/lang/nl.js', |
|
760 'wp-includes/js/mediaelement/lang/pl.js', |
|
761 'wp-includes/js/mediaelement/lang/pt.js', |
|
762 'wp-includes/js/mediaelement/lang/ro.js', |
|
763 'wp-includes/js/mediaelement/lang/ru.js', |
|
764 'wp-includes/js/mediaelement/lang/sk.js', |
|
765 'wp-includes/js/mediaelement/lang/sv.js', |
|
766 'wp-includes/js/mediaelement/lang/uk.js', |
|
767 'wp-includes/js/mediaelement/lang/zh-cn.js', |
|
768 'wp-includes/js/mediaelement/lang/zh.js', |
|
769 'wp-includes/js/mediaelement/mediaelement-flash-audio-ogg.swf', |
|
770 'wp-includes/js/mediaelement/mediaelement-flash-audio.swf', |
|
771 'wp-includes/js/mediaelement/mediaelement-flash-video-hls.swf', |
|
772 'wp-includes/js/mediaelement/mediaelement-flash-video-mdash.swf', |
|
773 'wp-includes/js/mediaelement/mediaelement-flash-video.swf', |
|
774 'wp-includes/js/mediaelement/renderers/dailymotion.js', |
|
775 'wp-includes/js/mediaelement/renderers/dailymotion.min.js', |
|
776 'wp-includes/js/mediaelement/renderers/facebook.js', |
|
777 'wp-includes/js/mediaelement/renderers/facebook.min.js', |
|
778 'wp-includes/js/mediaelement/renderers/soundcloud.js', |
|
779 'wp-includes/js/mediaelement/renderers/soundcloud.min.js', |
|
780 'wp-includes/js/mediaelement/renderers/twitch.js', |
|
781 'wp-includes/js/mediaelement/renderers/twitch.min.js', |
698 ); |
782 ); |
699 |
783 |
700 /** |
784 /** |
701 * Stores new files in wp-content to copy |
785 * Stores new files in wp-content to copy |
702 * |
786 * |
708 * The content of this array should follow the following format: |
792 * The content of this array should follow the following format: |
709 * Filename (relative to wp-content) => Introduced version |
793 * Filename (relative to wp-content) => Introduced version |
710 * Directories should be noted by suffixing it with a trailing slash (/) |
794 * Directories should be noted by suffixing it with a trailing slash (/) |
711 * |
795 * |
712 * @since 3.2.0 |
796 * @since 3.2.0 |
|
797 * @since 4.7.0 New themes were not automatically installed for 4.4-4.6 on |
|
798 * upgrade. New themes are now installed again. To disable new |
|
799 * themes from being installed on upgrade, explicitly define |
|
800 * CORE_UPGRADE_SKIP_NEW_BUNDLED as false. |
713 * @global array $_new_bundled_files |
801 * @global array $_new_bundled_files |
714 * @var array |
802 * @var array |
715 * @name $_new_bundled_files |
803 * @name $_new_bundled_files |
716 */ |
804 */ |
717 global $_new_bundled_files; |
805 global $_new_bundled_files; |
718 |
806 |
719 $_new_bundled_files = array( |
807 $_new_bundled_files = array( |
720 'plugins/akismet/' => '2.0', |
808 'plugins/akismet/' => '2.0', |
721 'themes/twentyten/' => '3.0', |
809 'themes/twentyten/' => '3.0', |
722 'themes/twentyeleven/' => '3.2', |
810 'themes/twentyeleven/' => '3.2', |
723 'themes/twentytwelve/' => '3.5', |
811 'themes/twentytwelve/' => '3.5', |
724 'themes/twentythirteen/' => '3.6', |
812 'themes/twentythirteen/' => '3.6', |
725 'themes/twentyfourteen/' => '3.8', |
813 'themes/twentyfourteen/' => '3.8', |
726 'themes/twentyfifteen/' => '4.1', |
814 'themes/twentyfifteen/' => '4.1', |
|
815 'themes/twentysixteen/' => '4.4', |
|
816 'themes/twentyseventeen/' => '4.7', |
727 ); |
817 ); |
728 |
818 |
729 /** |
819 /** |
730 * Upgrade the core of WordPress. |
820 * Upgrades the core of WordPress. |
731 * |
821 * |
732 * This will create a .maintenance file at the base of the WordPress directory |
822 * This will create a .maintenance file at the base of the WordPress directory |
733 * to ensure that people can not access the web site, when the files are being |
823 * to ensure that people can not access the web site, when the files are being |
734 * copied to their locations. |
824 * copied to their locations. |
735 * |
825 * |
736 * The files in the {@link $_old_files} list will be removed and the new files |
826 * The files in the `$_old_files` list will be removed and the new files |
737 * copied from the zip file after the database is upgraded. |
827 * copied from the zip file after the database is upgraded. |
738 * |
828 * |
739 * The files in the {@link $_new_bundled_files} list will be added to the installation |
829 * The files in the `$_new_bundled_files` list will be added to the installation |
740 * if the version is greater than or equal to the old version being upgraded. |
830 * if the version is greater than or equal to the old version being upgraded. |
741 * |
831 * |
742 * The steps for the upgrader for after the new release is downloaded and |
832 * The steps for the upgrader for after the new release is downloaded and |
743 * unzipped is: |
833 * unzipped is: |
744 * 1. Test unzipped location for select files to ensure that unzipped worked. |
834 * 1. Test unzipped location for select files to ensure that unzipped worked. |
766 * themes, then if you edit the default theme, you should rename it, so that |
856 * themes, then if you edit the default theme, you should rename it, so that |
767 * your changes remain. |
857 * your changes remain. |
768 * |
858 * |
769 * @since 2.7.0 |
859 * @since 2.7.0 |
770 * |
860 * |
|
861 * @global WP_Filesystem_Base $wp_filesystem |
|
862 * @global array $_old_files |
|
863 * @global array $_new_bundled_files |
|
864 * @global wpdb $wpdb |
|
865 * @global string $wp_version |
|
866 * @global string $required_php_version |
|
867 * @global string $required_mysql_version |
|
868 * |
771 * @param string $from New release unzipped path. |
869 * @param string $from New release unzipped path. |
772 * @param string $to Path to old WordPress installation. |
870 * @param string $to Path to old WordPress installation. |
773 * @return WP_Error|null WP_Error on failure, null on success. |
871 * @return WP_Error|null WP_Error on failure, null on success. |
774 */ |
872 */ |
775 function update_core($from, $to) { |
873 function update_core($from, $to) { |
776 global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb; |
874 global $wp_filesystem, $_old_files, $_new_bundled_files, $wpdb; |
777 |
875 |
778 @set_time_limit( 300 ); |
876 @set_time_limit( 300 ); |
779 |
877 |
780 /** |
878 /** |
781 * Filter feedback messages displayed during the core update process. |
879 * Filters feedback messages displayed during the core update process. |
782 * |
880 * |
783 * The filter is first evaluated after the zip file for the latest version |
881 * The filter is first evaluated after the zip file for the latest version |
784 * has been downloaded and unzipped. It is evaluated five more times during |
882 * has been downloaded and unzipped. It is evaluated five more times during |
785 * the process: |
883 * the process: |
786 * |
884 * |
808 if ( ! $distro ) { |
906 if ( ! $distro ) { |
809 $wp_filesystem->delete( $from, true ); |
907 $wp_filesystem->delete( $from, true ); |
810 return new WP_Error( 'insane_distro', __('The update could not be unpacked') ); |
908 return new WP_Error( 'insane_distro', __('The update could not be unpacked') ); |
811 } |
909 } |
812 |
910 |
813 // Import $wp_version, $required_php_version, and $required_mysql_version from the new version |
911 |
814 // $wp_filesystem->wp_content_dir() returned unslashed pre-2.8 |
912 /* |
815 global $wp_version, $required_php_version, $required_mysql_version; |
913 * Import $wp_version, $required_php_version, and $required_mysql_version from the new version. |
816 |
914 * DO NOT globalise any variables imported from `version-current.php` in this function. |
|
915 * |
|
916 * BC Note: $wp_filesystem->wp_content_dir() returned unslashed pre-2.8 |
|
917 */ |
817 $versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php'; |
918 $versions_file = trailingslashit( $wp_filesystem->wp_content_dir() ) . 'upgrade/version-current.php'; |
818 if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) { |
919 if ( ! $wp_filesystem->copy( $from . $distro . 'wp-includes/version.php', $versions_file ) ) { |
819 $wp_filesystem->delete( $from, true ); |
920 $wp_filesystem->delete( $from, true ); |
820 return new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' ); |
921 return new WP_Error( 'copy_failed_for_version_file', __( 'The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.' ), 'wp-includes/version.php' ); |
821 } |
922 } |
859 |
960 |
860 $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); |
961 $checksums = get_core_checksums( $wp_version, isset( $wp_local_package ) ? $wp_local_package : 'en_US' ); |
861 if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) |
962 if ( is_array( $checksums ) && isset( $checksums[ $wp_version ] ) ) |
862 $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2 |
963 $checksums = $checksums[ $wp_version ]; // Compat code for 3.7-beta2 |
863 if ( is_array( $checksums ) ) { |
964 if ( is_array( $checksums ) ) { |
864 foreach( $checksums as $file => $checksum ) { |
965 foreach ( $checksums as $file => $checksum ) { |
865 if ( 'wp-content' == substr( $file, 0, 10 ) ) |
966 if ( 'wp-content' == substr( $file, 0, 10 ) ) |
866 continue; |
967 continue; |
867 if ( ! file_exists( ABSPATH . $file ) ) |
968 if ( ! file_exists( ABSPATH . $file ) ) |
868 continue; |
969 continue; |
869 if ( ! file_exists( $working_dir_local . $file ) ) |
970 if ( ! file_exists( $working_dir_local . $file ) ) |
|
971 continue; |
|
972 if ( '.' === dirname( $file ) && in_array( pathinfo( $file, PATHINFO_EXTENSION ), array( 'html', 'txt' ) ) ) |
870 continue; |
973 continue; |
871 if ( md5_file( ABSPATH . $file ) === $checksum ) |
974 if ( md5_file( ABSPATH . $file ) === $checksum ) |
872 $skip[] = $file; |
975 $skip[] = $file; |
873 else |
976 else |
874 $check_is_writable[ $file ] = ABSPATH . $file; |
977 $check_is_writable[ $file ] = ABSPATH . $file; |
1045 // Remove old files |
1152 // Remove old files |
1046 foreach ( $_old_files as $old_file ) { |
1153 foreach ( $_old_files as $old_file ) { |
1047 $old_file = $to . $old_file; |
1154 $old_file = $to . $old_file; |
1048 if ( !$wp_filesystem->exists($old_file) ) |
1155 if ( !$wp_filesystem->exists($old_file) ) |
1049 continue; |
1156 continue; |
1050 $wp_filesystem->delete($old_file, true); |
1157 |
|
1158 // If the file isn't deleted, try writing an empty string to the file instead. |
|
1159 if ( ! $wp_filesystem->delete( $old_file, true ) && $wp_filesystem->is_file( $old_file ) ) { |
|
1160 $wp_filesystem->put_contents( $old_file, '' ); |
|
1161 } |
1051 } |
1162 } |
1052 |
1163 |
1053 // Remove any Genericons example.html's from the filesystem |
1164 // Remove any Genericons example.html's from the filesystem |
1054 _upgrade_422_remove_genericons(); |
1165 _upgrade_422_remove_genericons(); |
|
1166 |
|
1167 // Remove the REST API plugin if its version is Beta 4 or lower |
|
1168 _upgrade_440_force_deactivate_incompatible_plugins(); |
1055 |
1169 |
1056 // Upgrade DB with separate request |
1170 // Upgrade DB with separate request |
1057 /** This filter is documented in wp-admin/includes/update-core.php */ |
1171 /** This filter is documented in wp-admin/includes/update-core.php */ |
1058 apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
1172 apply_filters( 'update_feedback', __( 'Upgrading database…' ) ); |
1059 $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
1173 $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db'); |
1060 wp_remote_post($db_upgrade_url, array('timeout' => 60)); |
1174 wp_remote_post($db_upgrade_url, array('timeout' => 60)); |
1061 |
1175 |
1062 // Clear the cache to prevent an update_option() from saving a stale db_version to the cache |
1176 // Clear the cache to prevent an update_option() from saving a stale db_version to the cache |
1063 wp_cache_flush(); |
1177 wp_cache_flush(); |
1064 // (Not all cache backends listen to 'flush') |
1178 // (Not all cache back ends listen to 'flush') |
1065 wp_cache_delete( 'alloptions', 'options' ); |
1179 wp_cache_delete( 'alloptions', 'options' ); |
1066 |
1180 |
1067 // Remove working directory |
1181 // Remove working directory |
1068 $wp_filesystem->delete($from, true); |
1182 $wp_filesystem->delete($from, true); |
1069 |
1183 |