Upgrade/Install: Remove unnecessary individual subfiles from `$_old_files` array.

On upgrade, the `$_old_files` array is used to cleanup any files that exist in a previous version of core but are no longer present in the current version.  Sometimes, an entire directory should be removed.  In the past, when a parent directory was included in the array, subfiles were also included for good measure.  

However, the code that removes the old files uses `$wp_filesystem->delete()` with the `$recursive` parameter set to `true`.  With this setup, individual subfiles are not required to be individually listed when their parent directory is already included in the `$_old_files` array.

This commit removes all individual subfiles from the `$_old_files` array when their parent directory is already included.

Props SergeyBiryukov, mhshohel, pbiron, oglekler.
Fixes #58995.
Built from https://develop.svn.wordpress.org/trunk@57598


git-svn-id: http://core.svn.wordpress.org/trunk@57099 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
davidbaumwald 2024-02-12 16:53:13 +00:00
parent 10b96420a5
commit 3fae0d4fe5
2 changed files with 1 additions and 115 deletions

View File

@ -37,8 +37,6 @@ $_old_files = array(
'wp-images/wp-small.png',
'wp-images/wpminilogo.png',
'wp.php',
// 2.0.8
'wp-includes/js/tinymce/plugins/inlinepopups/readme.txt',
// 2.1
'wp-admin/edit-form-ajax-cat.php',
'wp-admin/execute-pings.php',
@ -52,8 +50,6 @@ $_old_files = array(
'wp-includes/functions-formatting.php',
'wp-includes/functions-post.php',
'wp-includes/js/dbx-key.js',
'wp-includes/js/tinymce/plugins/autosave/langs/cs.js',
'wp-includes/js/tinymce/plugins/autosave/langs/sv.js',
'wp-includes/links.php',
'wp-includes/pluggable-functions.php',
'wp-includes/template-functions-author.php',
@ -64,7 +60,6 @@ $_old_files = array(
'wp-includes/wp-l10n.php',
// 2.2
'wp-admin/cat-js.php',
'wp-admin/import/b2.php',
'wp-includes/js/autosave-js.php',
'wp-includes/js/list-manipulation-js.php',
'wp-includes/js/wp-ajax-js.php',
@ -108,39 +103,19 @@ $_old_files = array(
'wp-admin/js/link-cat.js',
'wp-admin/profile-update.php',
'wp-admin/templates.php',
'wp-includes/images/wlw/WpComments.png',
'wp-includes/images/wlw/WpIcon.png',
'wp-includes/images/wlw/WpWatermark.png',
'wp-includes/js/dbx.js',
'wp-includes/js/fat.js',
'wp-includes/js/list-manipulation.js',
'wp-includes/js/tinymce/langs/en.js',
'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js',
'wp-includes/js/tinymce/plugins/autosave/langs',
'wp-includes/js/tinymce/plugins/directionality/images',
'wp-includes/js/tinymce/plugins/directionality/langs',
'wp-includes/js/tinymce/plugins/inlinepopups/css',
'wp-includes/js/tinymce/plugins/inlinepopups/images',
'wp-includes/js/tinymce/plugins/inlinepopups/jscripts',
'wp-includes/js/tinymce/plugins/paste/images',
'wp-includes/js/tinymce/plugins/paste/jscripts',
'wp-includes/js/tinymce/plugins/paste/langs',
'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php',
'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css',
'wp-includes/js/tinymce/plugins/spellchecker/images',
'wp-includes/js/tinymce/plugins/spellchecker/langs',
'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php',
'wp-includes/js/tinymce/plugins/wordpress/images',
'wp-includes/js/tinymce/plugins/wordpress/langs',
'wp-includes/js/tinymce/plugins/wordpress/wordpress.css',
'wp-includes/js/tinymce/plugins/wphelp',
'wp-includes/js/tinymce/themes/advanced/css',
'wp-includes/js/tinymce/themes/advanced/images',
'wp-includes/js/tinymce/themes/advanced/jscripts',
'wp-includes/js/tinymce/themes/advanced/langs',
// 2.5.1
'wp-includes/js/tinymce/tiny_mce_gzip.php',
// 2.6
@ -184,16 +159,11 @@ $_old_files = array(
'wp-includes/js/tinymce/tiny_mce_ext.js',
// 2.8
'wp-admin/js/users.js',
'wp-includes/js/swfupload/plugins/swfupload.documentready.js',
'wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js',
'wp-includes/js/swfupload/swfupload_f9.swf',
'wp-includes/js/tinymce/plugins/autosave',
'wp-includes/js/tinymce/plugins/paste/css',
'wp-includes/js/tinymce/utils/mclayer.js',
'wp-includes/js/tinymce/wordpress.css',
// 2.8.5
'wp-admin/import/btt.php',
'wp-admin/import/jkw.php',
// 2.9
'wp-admin/js/page.dev.js',
'wp-admin/js/page.js',
@ -250,12 +220,9 @@ $_old_files = array(
'wp-admin/wp-admin.css',
'wp-admin/wp-admin.dev.css',
'wp-includes/js/codepress',
'wp-includes/js/codepress/engines/khtml.js',
'wp-includes/js/codepress/engines/older.js',
'wp-includes/js/jquery/autocomplete.dev.js',
'wp-includes/js/jquery/autocomplete.js',
'wp-includes/js/jquery/interface.js',
'wp-includes/js/scriptaculous/prototype.js',
// Following file added back in 5.1, see #45645.
//'wp-includes/js/tinymce/wp-tinymce.js',
// 3.1
@ -277,7 +244,6 @@ $_old_files = array(
'wp-admin/sidebar.php',
'wp-includes/classes.php',
'wp-includes/js/tinymce/blank.htm',
'wp-includes/js/tinymce/plugins/media/css/content.css',
'wp-includes/js/tinymce/plugins/media/img',
'wp-includes/js/tinymce/plugins/safari',
// 3.2
@ -286,11 +252,6 @@ $_old_files = array(
'wp-admin/js/list-table.dev.js',
'wp-admin/js/list-table.js',
'wp-includes/default-embeds.php',
'wp-includes/js/tinymce/plugins/wordpress/img/help.gif',
'wp-includes/js/tinymce/plugins/wordpress/img/more.gif',
'wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif',
'wp-includes/js/tinymce/themes/advanced/img/fm.gif',
'wp-includes/js/tinymce/themes/advanced/img/sflogo.png',
// 3.3
'wp-admin/css/colors-classic-rtl.css',
'wp-admin/css/colors-classic-rtl.dev.css',
@ -346,12 +307,6 @@ $_old_files = array(
'wp-includes/js/tinymce/plugins/wplink/css',
'wp-includes/js/tinymce/plugins/wplink/img',
'wp-includes/js/tinymce/plugins/wplink/js',
'wp-includes/js/tinymce/themes/advanced/img/wpicons.png',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/button_bg.png',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/separator.gif',
// Don't delete, yet: 'wp-rss.php',
// Don't delete, yet: 'wp-rdf.php',
// Don't delete, yet: 'wp-rss2.php',
@ -365,27 +320,14 @@ $_old_files = array(
'wp-admin/index-extra.php',
'wp-admin/network/index-extra.php',
'wp-admin/user/index-extra.php',
'wp-admin/images/screenshots/admin-flyouts.png',
'wp-admin/images/screenshots/coediting.png',
'wp-admin/images/screenshots/drag-and-drop.png',
'wp-admin/images/screenshots/help-screen.png',
'wp-admin/images/screenshots/media-icon.png',
'wp-admin/images/screenshots/new-feature-pointer.png',
'wp-admin/images/screenshots/welcome-screen.png',
'wp-includes/css/editor-buttons.css',
'wp-includes/css/editor-buttons.dev.css',
'wp-includes/js/tinymce/plugins/paste/blank.htm',
'wp-includes/js/tinymce/plugins/wordpress/css',
'wp-includes/js/tinymce/plugins/wordpress/editor_plugin.dev.js',
'wp-includes/js/tinymce/plugins/wordpress/img/embedded.png',
'wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif',
'wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif',
'wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin.dev.js',
'wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css',
'wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.dev.js',
'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.dev.js',
'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.dev.js',
'wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png',
'wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js',
// Don't delete, yet: 'wp-pass.php',
// Don't delete, yet: 'wp-register.php',
@ -500,9 +442,6 @@ $_old_files = array(
'wp-admin/js/inline-edit-post.dev.js',
'wp-admin/js/categories.dev.js',
'wp-admin/js/editor.dev.js',
'wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js',
'wp-includes/js/tinymce/plugins/wpdialogs/js/popup.dev.js',
'wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js',
'wp-includes/js/plupload/handlers.dev.js',
'wp-includes/js/plupload/wp-plupload.dev.js',
'wp-includes/js/swfupload/handlers.dev.js',
@ -529,21 +468,11 @@ $_old_files = array(
'wp-includes/js/jquery/ui/jquery.effects.pulsate.min.js',
'wp-includes/js/jquery/ui/jquery.effects.transfer.min.js',
'wp-includes/js/jquery/ui/jquery.effects.fold.min.js',
'wp-admin/images/screenshots/captions-1.png',
'wp-admin/images/screenshots/captions-2.png',
'wp-admin/images/screenshots/flex-header-1.png',
'wp-admin/images/screenshots/flex-header-2.png',
'wp-admin/images/screenshots/flex-header-3.png',
'wp-admin/images/screenshots/flex-header-media-library.png',
'wp-admin/images/screenshots/theme-customizer.png',
'wp-admin/images/screenshots/twitter-embed-1.png',
'wp-admin/images/screenshots/twitter-embed-2.png',
'wp-admin/js/utils.js',
// Added back in 5.3 [45448], see #43895.
// 'wp-admin/options-privacy.php',
'wp-app.php',
'wp-includes/class-wp-atom-server.php',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css',
// 3.5.2
'wp-includes/js/swfupload/swfupload-all.js',
// 3.6
@ -556,10 +485,7 @@ $_old_files = array(
// 3.7
'wp-admin/js/cat.js',
'wp-admin/js/cat.min.js',
'wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.min.js',
// 3.8
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/page_bug.gif',
'wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/more_bug.gif',
'wp-includes/js/thickbox/tb-close-2x.png',
'wp-includes/js/thickbox/tb-close.png',
'wp-includes/images/wpmini-blue-2x.png',
@ -630,7 +556,6 @@ $_old_files = array(
'wp-includes/js/tinymce/plugins/wpeditimage/js',
'wp-includes/js/tinymce/plugins/wpeditimage/css',
'wp-includes/js/tinymce/plugins/wpgallery/img',
'wp-includes/js/tinymce/plugins/wpfullscreen/css',
'wp-includes/js/tinymce/plugins/paste/js',
'wp-includes/js/tinymce/themes/advanced',
'wp-includes/js/tinymce/tiny_mce.js',
@ -659,8 +584,6 @@ $_old_files = array(
'wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js',
'wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.js',
'wp-includes/js/tinymce/plugins/tabfocus/editor_plugin_src.js',
'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin.js',
'wp-includes/js/tinymce/plugins/wpfullscreen/editor_plugin_src.js',
'wp-includes/js/tinymce/plugins/paste/editor_plugin.js',
'wp-includes/js/tinymce/plugins/paste/pasteword.htm',
'wp-includes/js/tinymce/plugins/paste/editor_plugin_src.js',
@ -750,27 +673,6 @@ $_old_files = array(
'wp-includes/js/swfupload/swfupload.swf',
// 4.9.2
'wp-includes/js/mediaelement/lang',
'wp-includes/js/mediaelement/lang/ca.js',
'wp-includes/js/mediaelement/lang/cs.js',
'wp-includes/js/mediaelement/lang/de.js',
'wp-includes/js/mediaelement/lang/es.js',
'wp-includes/js/mediaelement/lang/fa.js',
'wp-includes/js/mediaelement/lang/fr.js',
'wp-includes/js/mediaelement/lang/hr.js',
'wp-includes/js/mediaelement/lang/hu.js',
'wp-includes/js/mediaelement/lang/it.js',
'wp-includes/js/mediaelement/lang/ja.js',
'wp-includes/js/mediaelement/lang/ko.js',
'wp-includes/js/mediaelement/lang/nl.js',
'wp-includes/js/mediaelement/lang/pl.js',
'wp-includes/js/mediaelement/lang/pt.js',
'wp-includes/js/mediaelement/lang/ro.js',
'wp-includes/js/mediaelement/lang/ru.js',
'wp-includes/js/mediaelement/lang/sk.js',
'wp-includes/js/mediaelement/lang/sv.js',
'wp-includes/js/mediaelement/lang/uk.js',
'wp-includes/js/mediaelement/lang/zh-cn.js',
'wp-includes/js/mediaelement/lang/zh.js',
'wp-includes/js/mediaelement/mediaelement-flash-audio-ogg.swf',
'wp-includes/js/mediaelement/mediaelement-flash-audio.swf',
'wp-includes/js/mediaelement/mediaelement-flash-video-hls.swf',
@ -787,7 +689,6 @@ $_old_files = array(
// 5.0
'wp-includes/js/codemirror/jshint.js',
// 5.1
'wp-includes/random_compat/random_bytes_openssl.php',
'wp-includes/js/tinymce/wp-tinymce.js.gz',
// 5.3
'wp-includes/js/wp-a11y.js', // Moved to: wp-includes/js/dist/a11y.js
@ -822,7 +723,6 @@ $_old_files = array(
'wp-includes/block-patterns/text-two-columns-with-images.php',
'wp-includes/block-patterns/text-two-columns.php',
'wp-includes/block-patterns/large-header-button.php',
'wp-includes/blocks/subhead/block.json',
'wp-includes/blocks/subhead',
'wp-includes/css/dist/editor/editor-styles.css',
'wp-includes/css/dist/editor/editor-styles.min.css',
@ -843,21 +743,7 @@ $_old_files = array(
'wp-includes/blocks/tag-cloud/editor-rtl.min.css',
// 6.1
'wp-includes/blocks/post-comments.php',
'wp-includes/blocks/post-comments/block.json',
'wp-includes/blocks/post-comments/editor.css',
'wp-includes/blocks/post-comments/editor.min.css',
'wp-includes/blocks/post-comments/editor-rtl.css',
'wp-includes/blocks/post-comments/editor-rtl.min.css',
'wp-includes/blocks/post-comments/style.css',
'wp-includes/blocks/post-comments/style.min.css',
'wp-includes/blocks/post-comments/style-rtl.css',
'wp-includes/blocks/post-comments/style-rtl.min.css',
'wp-includes/blocks/post-comments',
'wp-includes/blocks/comments-query-loop/block.json',
'wp-includes/blocks/comments-query-loop/editor.css',
'wp-includes/blocks/comments-query-loop/editor.min.css',
'wp-includes/blocks/comments-query-loop/editor-rtl.css',
'wp-includes/blocks/comments-query-loop/editor-rtl.min.css',
'wp-includes/blocks/comments-query-loop',
// 6.3
'wp-includes/images/wlw',

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.5-alpha-57597';
$wp_version = '6.5-alpha-57598';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.