From de0171d18ec831f2edf206f5eb99539188b3eeca Mon Sep 17 00:00:00 2001 From: Aaron Jorbin <622599+aaronjorbin@users.noreply.github.com> Date: Tue, 14 Oct 2025 16:05:45 +0200 Subject: [PATCH 1/7] Revert commits related to moving hello-dolly Patch prepared in SVN by running the following commands: svn merge -c -60725 . svn merge -c -60721 . svn merge -c -60716 . svn merge -c -60770 . svn merge -c -60666 . --- .gitignore | 3 +- Gruntfile.js | 2 +- src/wp-admin/includes/plugin.php | 6 + src/wp-admin/includes/update-core.php | 3 - src/wp-admin/includes/upgrade.php | 32 +++--- src/wp-content/plugins/hello-dolly/hello.php | 106 ------------------ .../class-wp-plugin-dependencies.php | 3 + tests/phpunit/tests/admin/includesPlugin.php | 30 ++--- .../plugin-dependencies/hasDependents.php | 2 +- .../admin/plugin-dependencies/initialize.php | 6 +- .../phpunit/tests/ajax/wpAjaxUpdatePlugin.php | 4 +- tests/phpunit/tests/block-templates/base.php | 1 + tests/phpunit/tests/dependencies/scripts.php | 2 +- tests/phpunit/tests/image/base.php | 2 +- tests/phpunit/tests/image/resize.php | 5 +- tests/phpunit/tests/multisite/network.php | 14 +-- 16 files changed, 63 insertions(+), 158 deletions(-) delete mode 100644 src/wp-content/plugins/hello-dolly/hello.php diff --git a/.gitignore b/.gitignore index 577600ddf79d9..648c711b21f26 100644 --- a/.gitignore +++ b/.gitignore @@ -50,8 +50,7 @@ wp-tests-config.php /src/wp-content/fonts /src/wp-content/languages /src/wp-content/mu-plugins -/src/wp-content/plugins/* -!/src/wp-content/plugins/hello-dolly +/src/wp-content/plugins /src/wp-content/themes/* !/src/wp-content/themes/twentyten !/src/wp-content/themes/twentyeleven diff --git a/Gruntfile.js b/Gruntfile.js index a13c6e49526c5..6e35b0d668ad2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,7 +28,7 @@ module.exports = function(grunt) { 'wp-content/themes/index.php', 'wp-content/themes/twenty*/**', 'wp-content/plugins/index.php', - 'wp-content/plugins/hello-dolly/**', + 'wp-content/plugins/hello.php', 'wp-content/plugins/akismet/**', '!wp-content/themes/twenty*/node_modules/**', ], diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index b1167b2e4c837..de1468352b3d9 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -153,6 +153,8 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); } } + } elseif ( 'hello.php' === basename( $plugin_file ) ) { + $textdomain = 'default'; } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { @@ -1006,6 +1008,10 @@ function delete_plugins( $plugins, $deprecated = '' ) { $plugin_slug = dirname( $plugin_file ); + if ( 'hello.php' === $plugin_file ) { + $plugin_slug = 'hello-dolly'; + } + // Remove language files, silently. if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { $translations = $plugin_translations[ $plugin_slug ]; diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 138780dc5a236..2d925afa636d2 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -841,8 +841,6 @@ 'wp-includes/js/dist/undo-manager.min.js', 'wp-includes/js/dist/fields.min.js', 'wp-includes/js/dist/fields.js', - // 6.9 - 'wp-content/plugins/hello.php', ); /** @@ -975,7 +973,6 @@ 'themes/twentytwentythree/' => '6.1', 'themes/twentytwentyfour/' => '6.4', 'themes/twentytwentyfive/' => '6.7', - 'plugins/hello-dolly/' => '6.9', ); /** diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 551d1016b4e2b..fe89c091a94d9 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -886,10 +886,6 @@ function upgrade_all() { upgrade_682(); } - if ( $wp_current_db_version < 60717 ) { - upgrade_690(); - } - maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -2418,7 +2414,6 @@ function upgrade_650() { wp_set_option_autoload_values( $autoload ); } } - /** * Executes changes made in WordPress 6.7.0. * @@ -2491,22 +2486,25 @@ function ( $url ) { * @ignore * @since 6.9.0 * - * @global int $wp_current_db_version The old (current) database version. + * @global int $wp_current_db_version The old (current) database version. + * @global wpdb $wpdb WordPress database abstraction object. */ function upgrade_690() { - global $wp_current_db_version; + global $wp_current_db_version, $wpdb; - if ( $wp_current_db_version < 60717 ) { - // Switch Hello Dolly from file to directory format. See #53323 - $active_plugins = (array) get_option( 'active_plugins', array() ); - $old_plugin = 'hello.php'; - $new_plugin = 'hello-dolly/hello.php'; - $key = array_search( $old_plugin, $active_plugins, true ); + // Switch Hello Dolly from file to directory format. See #53323 + $active_plugins = get_option( 'active_plugins' ); + $old_plugin = 'hello.php'; + $new_plugin = 'hello-dolly/hello.php'; + $key = array_search( $old_plugin, $active_plugins, true ); - if ( $key ) { - $active_plugins[ $key ] = $new_plugin; - update_option( 'active_plugins', $active_plugins ); - } + if ( $key ) { + $active_plugins[ $key ] = $new_plugin; + update_option( 'active_plugins', $active_plugins ); + } + + if ( $wp_current_db_version < 60717 ) { + $wpdb->query( "ALTER TABLE $wpdb->posts ADD INDEX type_status_author (post_type,post_status,post_author)" ); } } diff --git a/src/wp-content/plugins/hello-dolly/hello.php b/src/wp-content/plugins/hello-dolly/hello.php deleted file mode 100644 index f820405da93e4..0000000000000 --- a/src/wp-content/plugins/hello-dolly/hello.php +++ /dev/null @@ -1,106 +0,0 @@ -Hello, Dolly in the upper right of your admin screen on every page. -Author: Matt Mullenweg -Version: 1.7.2 -Author URI: http://ma.tt/ -Text Domain: hello-dolly -*/ - -// Do not load directly. -if ( ! defined( 'ABSPATH' ) ) { - die(); -} - -function hello_dolly_get_lyric() { - /** These are the lyrics to Hello Dolly */ - $lyrics = "Hello, Dolly -Well, hello, Dolly -It's so nice to have you back where you belong -You're lookin' swell, Dolly -I can tell, Dolly -You're still glowin', you're still crowin' -You're still goin' strong -I feel the room swayin' -While the band's playin' -One of our old favorite songs from way back when -So, take her wrap, fellas -Dolly, never go away again -Hello, Dolly -Well, hello, Dolly -It's so nice to have you back where you belong -You're lookin' swell, Dolly -I can tell, Dolly -You're still glowin', you're still crowin' -You're still goin' strong -I feel the room swayin' -While the band's playin' -One of our old favorite songs from way back when -So, golly, gee, fellas -Have a little faith in me, fellas -Dolly, never go away -Promise, you'll never go away -Dolly'll never go away again"; - - // Here we split it into lines. - $lyrics = explode( "\n", $lyrics ); - - // And then randomly choose a line. - return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] ); -} - -// This just echoes the chosen line, we'll position it later. -function hello_dolly() { - $chosen = hello_dolly_get_lyric(); - $lang = ''; - if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) { - $lang = ' lang="en"'; - } - - printf( - '

%s %s

', - __( 'Quote from Hello Dolly song, by Jerry Herman:' ), - $lang, - $chosen - ); -} - -// Now we set that function up to execute when the admin_notices action is called. -add_action( 'admin_notices', 'hello_dolly' ); - -// We need some CSS to position the paragraph. -function dolly_css() { - echo " - - "; -} - -add_action( 'admin_head', 'dolly_css' ); diff --git a/src/wp-includes/class-wp-plugin-dependencies.php b/src/wp-includes/class-wp-plugin-dependencies.php index ee5e999903fb7..e4dc4b0f40c0c 100644 --- a/src/wp-includes/class-wp-plugin-dependencies.php +++ b/src/wp-includes/class-wp-plugin-dependencies.php @@ -870,6 +870,9 @@ protected static function check_for_circular_dependencies( $dependents, $depende * @return string The plugin's slug. */ protected static function convert_to_slug( $plugin_file ) { + if ( 'hello.php' === $plugin_file ) { + return 'hello-dolly'; + } return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file ); } } diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php index e1b48ab0c45f3..4d47fb7db0a81 100644 --- a/tests/phpunit/tests/admin/includesPlugin.php +++ b/tests/phpunit/tests/admin/includesPlugin.php @@ -22,7 +22,7 @@ public static function wpTearDownAfterClass() { } public function test_get_plugin_data() { - $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello-dolly/hello.php' ); + $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' ); $default_headers = array( 'Name' => 'Hello Dolly', @@ -374,38 +374,38 @@ public function test_passing_float_as_position_does_not_override_int() { } public function test_is_plugin_active_true() { - activate_plugin( 'hello-dolly/hello.php' ); - $test = is_plugin_active( 'hello-dolly/hello.php' ); + activate_plugin( 'hello.php' ); + $test = is_plugin_active( 'hello.php' ); $this->assertTrue( $test ); - deactivate_plugins( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); } public function test_is_plugin_active_false() { - deactivate_plugins( 'hello-dolly/hello.php' ); - $test = is_plugin_active( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); + $test = is_plugin_active( 'hello.php' ); $this->assertFalse( $test ); } public function test_is_plugin_inactive_true() { - deactivate_plugins( 'hello-dolly/hello.php' ); - $test = is_plugin_inactive( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); + $test = is_plugin_inactive( 'hello.php' ); $this->assertTrue( $test ); } public function test_is_plugin_inactive_false() { - activate_plugin( 'hello-dolly/hello.php' ); - $test = is_plugin_inactive( 'hello-dolly/hello.php' ); + activate_plugin( 'hello.php' ); + $test = is_plugin_inactive( 'hello.php' ); $this->assertFalse( $test ); - deactivate_plugins( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); } /** * @covers ::get_plugin_files */ public function test_get_plugin_files_single() { - $name = 'hello-dolly/hello.php'; + $name = 'hello.php'; $this->assertSame( array( $name ), get_plugin_files( $name ) ); } @@ -550,7 +550,7 @@ public function test_get_dropins_not_empty() { * @covers ::is_network_only_plugin */ public function test_is_network_only_plugin_hello() { - $this->assertFalse( is_network_only_plugin( 'hello-dolly/hello.php' ) ); + $this->assertFalse( is_network_only_plugin( 'hello.php' ) ); } /** @@ -570,7 +570,7 @@ public function test_is_network_only_plugin() { * @covers ::activate_plugins */ public function test_activate_plugins_single_no_array() { - $name = 'hello-dolly/hello.php'; + $name = 'hello.php'; activate_plugins( $name ); $this->assertTrue( is_plugin_active( $name ) ); deactivate_plugins( $name ); @@ -580,7 +580,7 @@ public function test_activate_plugins_single_no_array() { * @covers ::activate_plugins */ public function test_activate_plugins_single_array() { - $name = 'hello-dolly/hello.php'; + $name = 'hello.php'; activate_plugins( array( $name ) ); $this->assertTrue( is_plugin_active( $name ) ); deactivate_plugins( $name ); diff --git a/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php b/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php index 9b900ebcae44b..43093537ba992 100644 --- a/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php +++ b/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php @@ -53,6 +53,6 @@ public function test_should_return_false_when_a_plugin_has_no_dependents() { */ public function test_should_convert_hellophp_to_hello_dolly() { $this->set_property_value( 'dependency_slugs', array( 'hello-dolly' ) ); - $this->assertTrue( self::$instance::has_dependents( 'hello-dolly/hello.php' ) ); + $this->assertTrue( self::$instance::has_dependents( 'hello.php' ) ); } } diff --git a/tests/phpunit/tests/admin/plugin-dependencies/initialize.php b/tests/phpunit/tests/admin/plugin-dependencies/initialize.php index e83d4d59242ac..375e30c4bd6e2 100644 --- a/tests/phpunit/tests/admin/plugin-dependencies/initialize.php +++ b/tests/phpunit/tests/admin/plugin-dependencies/initialize.php @@ -281,7 +281,11 @@ public function test_should_slugify_dependent_files() { $expected_slugs = array(); foreach ( $plugins as $plugin_file => &$headers ) { // Create the expected slugs. - $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] ); + if ( 'hello.php' === $plugin_file ) { + $slug = 'hello-dolly'; + } else { + $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] ); + } $expected_slugs[ $plugin_file ] = $slug; diff --git a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php b/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php index 794f7215b72d1..08d65879ee0cb 100644 --- a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php +++ b/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php @@ -138,7 +138,7 @@ public function test_update_plugin() { $this->_setRole( 'administrator' ); $_POST['_ajax_nonce'] = wp_create_nonce( 'updates' ); - $_POST['plugin'] = 'hello-dolly/hello.php'; + $_POST['plugin'] = 'hello.php'; $_POST['slug'] = 'hello-dolly'; // Prevent wp_update_plugins() from running. @@ -163,7 +163,7 @@ public function test_update_plugin() { 'slug' => 'hello-dolly', 'oldVersion' => 'Version 1.7.2', 'newVersion' => '', - 'plugin' => 'hello-dolly/hello.php', + 'plugin' => 'hello.php', 'pluginName' => 'Hello Dolly', 'debug' => array( 'The plugin is at the latest version.' ), 'errorMessage' => 'The plugin is at the latest version.', diff --git a/tests/phpunit/tests/block-templates/base.php b/tests/phpunit/tests/block-templates/base.php index 133e5a7ba05ff..daa58c041cbd6 100644 --- a/tests/phpunit/tests/block-templates/base.php +++ b/tests/phpunit/tests/block-templates/base.php @@ -1,6 +1,7 @@ $real_file ) ); $this->assertNonEmptyMultidimensionalArray( $wp_enqueue_code_editor ); diff --git a/tests/phpunit/tests/image/base.php b/tests/phpunit/tests/image/base.php index 496eac18a3792..1e31522b2221c 100644 --- a/tests/phpunit/tests/image/base.php +++ b/tests/phpunit/tests/image/base.php @@ -1,7 +1,7 @@ assertSame( array( WP_PLUGIN_DIR . '/hello-dolly/hello.php' ), $active_plugins ); + $this->assertSame( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins ); // Deactivate the plugin. deactivate_plugins( $path ); @@ -304,7 +304,7 @@ public function test_active_network_plugins() { * @ticket 28651 */ public function test_duplicate_network_active_plugin() { - $path = 'hello-dolly/hello.php'; + $path = 'hello.php'; $mock = new MockAction(); add_action( 'activate_' . $path, array( $mock, 'action' ) ); @@ -324,13 +324,13 @@ public function test_duplicate_network_active_plugin() { } public function test_is_plugin_active_for_network_true() { - activate_plugin( 'hello-dolly/hello.php', '', true ); - $this->assertTrue( is_plugin_active_for_network( 'hello-dolly/hello.php' ) ); + activate_plugin( 'hello.php', '', true ); + $this->assertTrue( is_plugin_active_for_network( 'hello.php' ) ); } public function test_is_plugin_active_for_network_false() { - deactivate_plugins( 'hello-dolly/hello.php', false, true ); - $this->assertFalse( is_plugin_active_for_network( 'hello-dolly/hello.php' ) ); + deactivate_plugins( 'hello.php', false, true ); + $this->assertFalse( is_plugin_active_for_network( 'hello.php' ) ); } public function helper_deactivate_hook() { From 1c290c65781c6843ad4ae46bb4d5eede8936ef89 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin <622599+aaronjorbin@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:04:19 +0200 Subject: [PATCH 2/7] Remove `upgrade_690()` entirely --- src/wp-admin/includes/upgrade.php | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index fe89c091a94d9..5b5d75a4c98ae 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -2480,34 +2480,6 @@ function ( $url ) { } } -/** - * Executes changes made in WordPress 6.9.0. - * - * @ignore - * @since 6.9.0 - * - * @global int $wp_current_db_version The old (current) database version. - * @global wpdb $wpdb WordPress database abstraction object. - */ -function upgrade_690() { - global $wp_current_db_version, $wpdb; - - // Switch Hello Dolly from file to directory format. See #53323 - $active_plugins = get_option( 'active_plugins' ); - $old_plugin = 'hello.php'; - $new_plugin = 'hello-dolly/hello.php'; - $key = array_search( $old_plugin, $active_plugins, true ); - - if ( $key ) { - $active_plugins[ $key ] = $new_plugin; - update_option( 'active_plugins', $active_plugins ); - } - - if ( $wp_current_db_version < 60717 ) { - $wpdb->query( "ALTER TABLE $wpdb->posts ADD INDEX type_status_author (post_type,post_status,post_author)" ); - } -} - /** * Executes network-level upgrade routines. * From 41cbe41f654aa0653077b2e7f18b00b936a4a633 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin <622599+aaronjorbin@users.noreply.github.com> Date: Wed, 15 Oct 2025 13:05:27 +0200 Subject: [PATCH 3/7] Move file in plugin --- tests/phpunit/data/plugins/{hello-dolly => }/hello.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/phpunit/data/plugins/{hello-dolly => }/hello.php (100%) diff --git a/tests/phpunit/data/plugins/hello-dolly/hello.php b/tests/phpunit/data/plugins/hello.php similarity index 100% rename from tests/phpunit/data/plugins/hello-dolly/hello.php rename to tests/phpunit/data/plugins/hello.php From 9762fdfc2aca1d20a19f8ccc28915b94314b216c Mon Sep 17 00:00:00 2001 From: Aaron Jorbin <622599+aaronjorbin@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:25:34 +0200 Subject: [PATCH 4/7] clean the branch --- .gitignore | 3 +- Gruntfile.js | 2 +- src/wp-admin/includes/plugin.php | 6 - src/wp-admin/includes/update-core.php | 3 + src/wp-admin/includes/upgrade.php | 30 +++++ src/wp-content/plugins/hello-dolly/hello.php | 106 ++++++++++++++++++ .../class-wp-plugin-dependencies.php | 3 - .../data/plugins/{ => hello-dolly}/hello.php | 0 tests/phpunit/tests/admin/includesPlugin.php | 30 ++--- .../plugin-dependencies/hasDependents.php | 2 +- .../admin/plugin-dependencies/initialize.php | 6 +- .../phpunit/tests/ajax/wpAjaxUpdatePlugin.php | 4 +- tests/phpunit/tests/block-templates/base.php | 1 - tests/phpunit/tests/dependencies/scripts.php | 2 +- tests/phpunit/tests/image/base.php | 2 +- tests/phpunit/tests/image/resize.php | 5 +- tests/phpunit/tests/multisite/network.php | 14 +-- 17 files changed, 171 insertions(+), 48 deletions(-) create mode 100644 src/wp-content/plugins/hello-dolly/hello.php rename tests/phpunit/data/plugins/{ => hello-dolly}/hello.php (100%) diff --git a/.gitignore b/.gitignore index 648c711b21f26..577600ddf79d9 100644 --- a/.gitignore +++ b/.gitignore @@ -50,7 +50,8 @@ wp-tests-config.php /src/wp-content/fonts /src/wp-content/languages /src/wp-content/mu-plugins -/src/wp-content/plugins +/src/wp-content/plugins/* +!/src/wp-content/plugins/hello-dolly /src/wp-content/themes/* !/src/wp-content/themes/twentyten !/src/wp-content/themes/twentyeleven diff --git a/Gruntfile.js b/Gruntfile.js index 6e35b0d668ad2..a13c6e49526c5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,7 +28,7 @@ module.exports = function(grunt) { 'wp-content/themes/index.php', 'wp-content/themes/twenty*/**', 'wp-content/plugins/index.php', - 'wp-content/plugins/hello.php', + 'wp-content/plugins/hello-dolly/**', 'wp-content/plugins/akismet/**', '!wp-content/themes/twenty*/node_modules/**', ], diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index de1468352b3d9..b1167b2e4c837 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -153,8 +153,6 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); } } - } elseif ( 'hello.php' === basename( $plugin_file ) ) { - $textdomain = 'default'; } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { @@ -1008,10 +1006,6 @@ function delete_plugins( $plugins, $deprecated = '' ) { $plugin_slug = dirname( $plugin_file ); - if ( 'hello.php' === $plugin_file ) { - $plugin_slug = 'hello-dolly'; - } - // Remove language files, silently. if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { $translations = $plugin_translations[ $plugin_slug ]; diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 2d925afa636d2..138780dc5a236 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -841,6 +841,8 @@ 'wp-includes/js/dist/undo-manager.min.js', 'wp-includes/js/dist/fields.min.js', 'wp-includes/js/dist/fields.js', + // 6.9 + 'wp-content/plugins/hello.php', ); /** @@ -973,6 +975,7 @@ 'themes/twentytwentythree/' => '6.1', 'themes/twentytwentyfour/' => '6.4', 'themes/twentytwentyfive/' => '6.7', + 'plugins/hello-dolly/' => '6.9', ); /** diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 5b5d75a4c98ae..551d1016b4e2b 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -886,6 +886,10 @@ function upgrade_all() { upgrade_682(); } + if ( $wp_current_db_version < 60717 ) { + upgrade_690(); + } + maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -2414,6 +2418,7 @@ function upgrade_650() { wp_set_option_autoload_values( $autoload ); } } + /** * Executes changes made in WordPress 6.7.0. * @@ -2480,6 +2485,31 @@ function ( $url ) { } } +/** + * Executes changes made in WordPress 6.9.0. + * + * @ignore + * @since 6.9.0 + * + * @global int $wp_current_db_version The old (current) database version. + */ +function upgrade_690() { + global $wp_current_db_version; + + if ( $wp_current_db_version < 60717 ) { + // Switch Hello Dolly from file to directory format. See #53323 + $active_plugins = (array) get_option( 'active_plugins', array() ); + $old_plugin = 'hello.php'; + $new_plugin = 'hello-dolly/hello.php'; + $key = array_search( $old_plugin, $active_plugins, true ); + + if ( $key ) { + $active_plugins[ $key ] = $new_plugin; + update_option( 'active_plugins', $active_plugins ); + } + } +} + /** * Executes network-level upgrade routines. * diff --git a/src/wp-content/plugins/hello-dolly/hello.php b/src/wp-content/plugins/hello-dolly/hello.php new file mode 100644 index 0000000000000..f820405da93e4 --- /dev/null +++ b/src/wp-content/plugins/hello-dolly/hello.php @@ -0,0 +1,106 @@ +Hello, Dolly in the upper right of your admin screen on every page. +Author: Matt Mullenweg +Version: 1.7.2 +Author URI: http://ma.tt/ +Text Domain: hello-dolly +*/ + +// Do not load directly. +if ( ! defined( 'ABSPATH' ) ) { + die(); +} + +function hello_dolly_get_lyric() { + /** These are the lyrics to Hello Dolly */ + $lyrics = "Hello, Dolly +Well, hello, Dolly +It's so nice to have you back where you belong +You're lookin' swell, Dolly +I can tell, Dolly +You're still glowin', you're still crowin' +You're still goin' strong +I feel the room swayin' +While the band's playin' +One of our old favorite songs from way back when +So, take her wrap, fellas +Dolly, never go away again +Hello, Dolly +Well, hello, Dolly +It's so nice to have you back where you belong +You're lookin' swell, Dolly +I can tell, Dolly +You're still glowin', you're still crowin' +You're still goin' strong +I feel the room swayin' +While the band's playin' +One of our old favorite songs from way back when +So, golly, gee, fellas +Have a little faith in me, fellas +Dolly, never go away +Promise, you'll never go away +Dolly'll never go away again"; + + // Here we split it into lines. + $lyrics = explode( "\n", $lyrics ); + + // And then randomly choose a line. + return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] ); +} + +// This just echoes the chosen line, we'll position it later. +function hello_dolly() { + $chosen = hello_dolly_get_lyric(); + $lang = ''; + if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) { + $lang = ' lang="en"'; + } + + printf( + '

%s %s

', + __( 'Quote from Hello Dolly song, by Jerry Herman:' ), + $lang, + $chosen + ); +} + +// Now we set that function up to execute when the admin_notices action is called. +add_action( 'admin_notices', 'hello_dolly' ); + +// We need some CSS to position the paragraph. +function dolly_css() { + echo " + + "; +} + +add_action( 'admin_head', 'dolly_css' ); diff --git a/src/wp-includes/class-wp-plugin-dependencies.php b/src/wp-includes/class-wp-plugin-dependencies.php index e4dc4b0f40c0c..ee5e999903fb7 100644 --- a/src/wp-includes/class-wp-plugin-dependencies.php +++ b/src/wp-includes/class-wp-plugin-dependencies.php @@ -870,9 +870,6 @@ protected static function check_for_circular_dependencies( $dependents, $depende * @return string The plugin's slug. */ protected static function convert_to_slug( $plugin_file ) { - if ( 'hello.php' === $plugin_file ) { - return 'hello-dolly'; - } return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file ); } } diff --git a/tests/phpunit/data/plugins/hello.php b/tests/phpunit/data/plugins/hello-dolly/hello.php similarity index 100% rename from tests/phpunit/data/plugins/hello.php rename to tests/phpunit/data/plugins/hello-dolly/hello.php diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php index 4d47fb7db0a81..e1b48ab0c45f3 100644 --- a/tests/phpunit/tests/admin/includesPlugin.php +++ b/tests/phpunit/tests/admin/includesPlugin.php @@ -22,7 +22,7 @@ public static function wpTearDownAfterClass() { } public function test_get_plugin_data() { - $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' ); + $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello-dolly/hello.php' ); $default_headers = array( 'Name' => 'Hello Dolly', @@ -374,38 +374,38 @@ public function test_passing_float_as_position_does_not_override_int() { } public function test_is_plugin_active_true() { - activate_plugin( 'hello.php' ); - $test = is_plugin_active( 'hello.php' ); + activate_plugin( 'hello-dolly/hello.php' ); + $test = is_plugin_active( 'hello-dolly/hello.php' ); $this->assertTrue( $test ); - deactivate_plugins( 'hello.php' ); + deactivate_plugins( 'hello-dolly/hello.php' ); } public function test_is_plugin_active_false() { - deactivate_plugins( 'hello.php' ); - $test = is_plugin_active( 'hello.php' ); + deactivate_plugins( 'hello-dolly/hello.php' ); + $test = is_plugin_active( 'hello-dolly/hello.php' ); $this->assertFalse( $test ); } public function test_is_plugin_inactive_true() { - deactivate_plugins( 'hello.php' ); - $test = is_plugin_inactive( 'hello.php' ); + deactivate_plugins( 'hello-dolly/hello.php' ); + $test = is_plugin_inactive( 'hello-dolly/hello.php' ); $this->assertTrue( $test ); } public function test_is_plugin_inactive_false() { - activate_plugin( 'hello.php' ); - $test = is_plugin_inactive( 'hello.php' ); + activate_plugin( 'hello-dolly/hello.php' ); + $test = is_plugin_inactive( 'hello-dolly/hello.php' ); $this->assertFalse( $test ); - deactivate_plugins( 'hello.php' ); + deactivate_plugins( 'hello-dolly/hello.php' ); } /** * @covers ::get_plugin_files */ public function test_get_plugin_files_single() { - $name = 'hello.php'; + $name = 'hello-dolly/hello.php'; $this->assertSame( array( $name ), get_plugin_files( $name ) ); } @@ -550,7 +550,7 @@ public function test_get_dropins_not_empty() { * @covers ::is_network_only_plugin */ public function test_is_network_only_plugin_hello() { - $this->assertFalse( is_network_only_plugin( 'hello.php' ) ); + $this->assertFalse( is_network_only_plugin( 'hello-dolly/hello.php' ) ); } /** @@ -570,7 +570,7 @@ public function test_is_network_only_plugin() { * @covers ::activate_plugins */ public function test_activate_plugins_single_no_array() { - $name = 'hello.php'; + $name = 'hello-dolly/hello.php'; activate_plugins( $name ); $this->assertTrue( is_plugin_active( $name ) ); deactivate_plugins( $name ); @@ -580,7 +580,7 @@ public function test_activate_plugins_single_no_array() { * @covers ::activate_plugins */ public function test_activate_plugins_single_array() { - $name = 'hello.php'; + $name = 'hello-dolly/hello.php'; activate_plugins( array( $name ) ); $this->assertTrue( is_plugin_active( $name ) ); deactivate_plugins( $name ); diff --git a/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php b/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php index 43093537ba992..9b900ebcae44b 100644 --- a/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php +++ b/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php @@ -53,6 +53,6 @@ public function test_should_return_false_when_a_plugin_has_no_dependents() { */ public function test_should_convert_hellophp_to_hello_dolly() { $this->set_property_value( 'dependency_slugs', array( 'hello-dolly' ) ); - $this->assertTrue( self::$instance::has_dependents( 'hello.php' ) ); + $this->assertTrue( self::$instance::has_dependents( 'hello-dolly/hello.php' ) ); } } diff --git a/tests/phpunit/tests/admin/plugin-dependencies/initialize.php b/tests/phpunit/tests/admin/plugin-dependencies/initialize.php index 375e30c4bd6e2..e83d4d59242ac 100644 --- a/tests/phpunit/tests/admin/plugin-dependencies/initialize.php +++ b/tests/phpunit/tests/admin/plugin-dependencies/initialize.php @@ -281,11 +281,7 @@ public function test_should_slugify_dependent_files() { $expected_slugs = array(); foreach ( $plugins as $plugin_file => &$headers ) { // Create the expected slugs. - if ( 'hello.php' === $plugin_file ) { - $slug = 'hello-dolly'; - } else { - $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] ); - } + $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] ); $expected_slugs[ $plugin_file ] = $slug; diff --git a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php b/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php index 08d65879ee0cb..794f7215b72d1 100644 --- a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php +++ b/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php @@ -138,7 +138,7 @@ public function test_update_plugin() { $this->_setRole( 'administrator' ); $_POST['_ajax_nonce'] = wp_create_nonce( 'updates' ); - $_POST['plugin'] = 'hello.php'; + $_POST['plugin'] = 'hello-dolly/hello.php'; $_POST['slug'] = 'hello-dolly'; // Prevent wp_update_plugins() from running. @@ -163,7 +163,7 @@ public function test_update_plugin() { 'slug' => 'hello-dolly', 'oldVersion' => 'Version 1.7.2', 'newVersion' => '', - 'plugin' => 'hello.php', + 'plugin' => 'hello-dolly/hello.php', 'pluginName' => 'Hello Dolly', 'debug' => array( 'The plugin is at the latest version.' ), 'errorMessage' => 'The plugin is at the latest version.', diff --git a/tests/phpunit/tests/block-templates/base.php b/tests/phpunit/tests/block-templates/base.php index daa58c041cbd6..133e5a7ba05ff 100644 --- a/tests/phpunit/tests/block-templates/base.php +++ b/tests/phpunit/tests/block-templates/base.php @@ -1,7 +1,6 @@ $real_file ) ); $this->assertNonEmptyMultidimensionalArray( $wp_enqueue_code_editor ); diff --git a/tests/phpunit/tests/image/base.php b/tests/phpunit/tests/image/base.php index 1e31522b2221c..496eac18a3792 100644 --- a/tests/phpunit/tests/image/base.php +++ b/tests/phpunit/tests/image/base.php @@ -1,7 +1,7 @@ assertSame( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins ); + $this->assertSame( array( WP_PLUGIN_DIR . '/hello-dolly/hello.php' ), $active_plugins ); // Deactivate the plugin. deactivate_plugins( $path ); @@ -304,7 +304,7 @@ public function test_active_network_plugins() { * @ticket 28651 */ public function test_duplicate_network_active_plugin() { - $path = 'hello.php'; + $path = 'hello-dolly/hello.php'; $mock = new MockAction(); add_action( 'activate_' . $path, array( $mock, 'action' ) ); @@ -324,13 +324,13 @@ public function test_duplicate_network_active_plugin() { } public function test_is_plugin_active_for_network_true() { - activate_plugin( 'hello.php', '', true ); - $this->assertTrue( is_plugin_active_for_network( 'hello.php' ) ); + activate_plugin( 'hello-dolly/hello.php', '', true ); + $this->assertTrue( is_plugin_active_for_network( 'hello-dolly/hello.php' ) ); } public function test_is_plugin_active_for_network_false() { - deactivate_plugins( 'hello.php', false, true ); - $this->assertFalse( is_plugin_active_for_network( 'hello.php' ) ); + deactivate_plugins( 'hello-dolly/hello.php', false, true ); + $this->assertFalse( is_plugin_active_for_network( 'hello-dolly/hello.php' ) ); } public function helper_deactivate_hook() { From d538d617c2f74da44fa332f948d7a42d2b7591b3 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin <622599+aaronjorbin@users.noreply.github.com> Date: Tue, 21 Oct 2025 01:49:35 +0200 Subject: [PATCH 5/7] try reverts again --- .gitignore | 3 +- Gruntfile.js | 2 +- src/wp-admin/includes/plugin.php | 6 +++ src/wp-admin/includes/update-core.php | 3 -- src/wp-admin/includes/upgrade.php | 40 ++----------------- .../plugins/{hello-dolly => }/hello.php | 6 --- .../class-wp-plugin-dependencies.php | 3 ++ .../data/plugins/{hello-dolly => }/hello.php | 0 tests/phpunit/tests/admin/includesPlugin.php | 30 +++++++------- .../plugin-dependencies/hasDependents.php | 2 +- .../admin/plugin-dependencies/initialize.php | 6 ++- .../phpunit/tests/ajax/wpAjaxUpdatePlugin.php | 4 +- tests/phpunit/tests/dependencies/scripts.php | 2 +- tests/phpunit/tests/multisite/network.php | 14 +++---- 14 files changed, 46 insertions(+), 75 deletions(-) rename src/wp-content/plugins/{hello-dolly => }/hello.php (96%) rename tests/phpunit/data/plugins/{hello-dolly => }/hello.php (100%) diff --git a/.gitignore b/.gitignore index 577600ddf79d9..648c711b21f26 100644 --- a/.gitignore +++ b/.gitignore @@ -50,8 +50,7 @@ wp-tests-config.php /src/wp-content/fonts /src/wp-content/languages /src/wp-content/mu-plugins -/src/wp-content/plugins/* -!/src/wp-content/plugins/hello-dolly +/src/wp-content/plugins /src/wp-content/themes/* !/src/wp-content/themes/twentyten !/src/wp-content/themes/twentyeleven diff --git a/Gruntfile.js b/Gruntfile.js index a13c6e49526c5..6e35b0d668ad2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -28,7 +28,7 @@ module.exports = function(grunt) { 'wp-content/themes/index.php', 'wp-content/themes/twenty*/**', 'wp-content/plugins/index.php', - 'wp-content/plugins/hello-dolly/**', + 'wp-content/plugins/hello.php', 'wp-content/plugins/akismet/**', '!wp-content/themes/twenty*/node_modules/**', ], diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index b1167b2e4c837..de1468352b3d9 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -153,6 +153,8 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) ); } } + } elseif ( 'hello.php' === basename( $plugin_file ) ) { + $textdomain = 'default'; } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { @@ -1006,6 +1008,10 @@ function delete_plugins( $plugins, $deprecated = '' ) { $plugin_slug = dirname( $plugin_file ); + if ( 'hello.php' === $plugin_file ) { + $plugin_slug = 'hello-dolly'; + } + // Remove language files, silently. if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) { $translations = $plugin_translations[ $plugin_slug ]; diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 138780dc5a236..2d925afa636d2 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -841,8 +841,6 @@ 'wp-includes/js/dist/undo-manager.min.js', 'wp-includes/js/dist/fields.min.js', 'wp-includes/js/dist/fields.js', - // 6.9 - 'wp-content/plugins/hello.php', ); /** @@ -975,7 +973,6 @@ 'themes/twentytwentythree/' => '6.1', 'themes/twentytwentyfour/' => '6.4', 'themes/twentytwentyfive/' => '6.7', - 'plugins/hello-dolly/' => '6.9', ); /** diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 551d1016b4e2b..95f090af9f7b1 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -886,10 +886,6 @@ function upgrade_all() { upgrade_682(); } - if ( $wp_current_db_version < 60717 ) { - upgrade_690(); - } - maybe_disable_link_manager(); maybe_disable_automattic_widgets(); @@ -2418,7 +2414,6 @@ function upgrade_650() { wp_set_option_autoload_values( $autoload ); } } - /** * Executes changes made in WordPress 6.7.0. * @@ -2485,31 +2480,6 @@ function ( $url ) { } } -/** - * Executes changes made in WordPress 6.9.0. - * - * @ignore - * @since 6.9.0 - * - * @global int $wp_current_db_version The old (current) database version. - */ -function upgrade_690() { - global $wp_current_db_version; - - if ( $wp_current_db_version < 60717 ) { - // Switch Hello Dolly from file to directory format. See #53323 - $active_plugins = (array) get_option( 'active_plugins', array() ); - $old_plugin = 'hello.php'; - $new_plugin = 'hello-dolly/hello.php'; - $key = array_search( $old_plugin, $active_plugins, true ); - - if ( $key ) { - $active_plugins[ $key ] = $new_plugin; - update_option( 'active_plugins', $active_plugins ); - } - } -} - /** * Executes network-level upgrade routines. * @@ -2962,10 +2932,8 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N // Create a tablename index for an array ($cqueries) of recognized query types. foreach ( $queries as $qry ) { if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { - $table_name = trim( $matches[1], '`' ); - - $cqueries[ $table_name ] = $qry; - $for_update[ $table_name ] = 'Created table ' . $matches[1]; + $cqueries[ trim( $matches[1], '`' ) ] = $qry; + $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; continue; } @@ -3203,7 +3171,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N $fieldtype_base = strtok( $fieldtype_without_parentheses, ' ' ); // Is actual field type different from the field type in query? - if ( $tablefield->Type !== $fieldtype_lowercased ) { + if ( $tablefield->Type !== $fieldtype ) { $do_change = true; if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) { if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) { @@ -3282,7 +3250,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N 'fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part, ); - $index_ary[ $keyname ]['unique'] = ( '0' === (string) $tableindex->Non_unique ) ? true : false; + $index_ary[ $keyname ]['unique'] = ( '0' === $tableindex->Non_unique ) ? true : false; $index_ary[ $keyname ]['index_type'] = $tableindex->Index_type; } diff --git a/src/wp-content/plugins/hello-dolly/hello.php b/src/wp-content/plugins/hello.php similarity index 96% rename from src/wp-content/plugins/hello-dolly/hello.php rename to src/wp-content/plugins/hello.php index f820405da93e4..ff55908342290 100644 --- a/src/wp-content/plugins/hello-dolly/hello.php +++ b/src/wp-content/plugins/hello.php @@ -10,14 +10,8 @@ Author: Matt Mullenweg Version: 1.7.2 Author URI: http://ma.tt/ -Text Domain: hello-dolly */ -// Do not load directly. -if ( ! defined( 'ABSPATH' ) ) { - die(); -} - function hello_dolly_get_lyric() { /** These are the lyrics to Hello Dolly */ $lyrics = "Hello, Dolly diff --git a/src/wp-includes/class-wp-plugin-dependencies.php b/src/wp-includes/class-wp-plugin-dependencies.php index ee5e999903fb7..e4dc4b0f40c0c 100644 --- a/src/wp-includes/class-wp-plugin-dependencies.php +++ b/src/wp-includes/class-wp-plugin-dependencies.php @@ -870,6 +870,9 @@ protected static function check_for_circular_dependencies( $dependents, $depende * @return string The plugin's slug. */ protected static function convert_to_slug( $plugin_file ) { + if ( 'hello.php' === $plugin_file ) { + return 'hello-dolly'; + } return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file ); } } diff --git a/tests/phpunit/data/plugins/hello-dolly/hello.php b/tests/phpunit/data/plugins/hello.php similarity index 100% rename from tests/phpunit/data/plugins/hello-dolly/hello.php rename to tests/phpunit/data/plugins/hello.php diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php index e1b48ab0c45f3..4d47fb7db0a81 100644 --- a/tests/phpunit/tests/admin/includesPlugin.php +++ b/tests/phpunit/tests/admin/includesPlugin.php @@ -22,7 +22,7 @@ public static function wpTearDownAfterClass() { } public function test_get_plugin_data() { - $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello-dolly/hello.php' ); + $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' ); $default_headers = array( 'Name' => 'Hello Dolly', @@ -374,38 +374,38 @@ public function test_passing_float_as_position_does_not_override_int() { } public function test_is_plugin_active_true() { - activate_plugin( 'hello-dolly/hello.php' ); - $test = is_plugin_active( 'hello-dolly/hello.php' ); + activate_plugin( 'hello.php' ); + $test = is_plugin_active( 'hello.php' ); $this->assertTrue( $test ); - deactivate_plugins( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); } public function test_is_plugin_active_false() { - deactivate_plugins( 'hello-dolly/hello.php' ); - $test = is_plugin_active( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); + $test = is_plugin_active( 'hello.php' ); $this->assertFalse( $test ); } public function test_is_plugin_inactive_true() { - deactivate_plugins( 'hello-dolly/hello.php' ); - $test = is_plugin_inactive( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); + $test = is_plugin_inactive( 'hello.php' ); $this->assertTrue( $test ); } public function test_is_plugin_inactive_false() { - activate_plugin( 'hello-dolly/hello.php' ); - $test = is_plugin_inactive( 'hello-dolly/hello.php' ); + activate_plugin( 'hello.php' ); + $test = is_plugin_inactive( 'hello.php' ); $this->assertFalse( $test ); - deactivate_plugins( 'hello-dolly/hello.php' ); + deactivate_plugins( 'hello.php' ); } /** * @covers ::get_plugin_files */ public function test_get_plugin_files_single() { - $name = 'hello-dolly/hello.php'; + $name = 'hello.php'; $this->assertSame( array( $name ), get_plugin_files( $name ) ); } @@ -550,7 +550,7 @@ public function test_get_dropins_not_empty() { * @covers ::is_network_only_plugin */ public function test_is_network_only_plugin_hello() { - $this->assertFalse( is_network_only_plugin( 'hello-dolly/hello.php' ) ); + $this->assertFalse( is_network_only_plugin( 'hello.php' ) ); } /** @@ -570,7 +570,7 @@ public function test_is_network_only_plugin() { * @covers ::activate_plugins */ public function test_activate_plugins_single_no_array() { - $name = 'hello-dolly/hello.php'; + $name = 'hello.php'; activate_plugins( $name ); $this->assertTrue( is_plugin_active( $name ) ); deactivate_plugins( $name ); @@ -580,7 +580,7 @@ public function test_activate_plugins_single_no_array() { * @covers ::activate_plugins */ public function test_activate_plugins_single_array() { - $name = 'hello-dolly/hello.php'; + $name = 'hello.php'; activate_plugins( array( $name ) ); $this->assertTrue( is_plugin_active( $name ) ); deactivate_plugins( $name ); diff --git a/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php b/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php index 9b900ebcae44b..43093537ba992 100644 --- a/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php +++ b/tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php @@ -53,6 +53,6 @@ public function test_should_return_false_when_a_plugin_has_no_dependents() { */ public function test_should_convert_hellophp_to_hello_dolly() { $this->set_property_value( 'dependency_slugs', array( 'hello-dolly' ) ); - $this->assertTrue( self::$instance::has_dependents( 'hello-dolly/hello.php' ) ); + $this->assertTrue( self::$instance::has_dependents( 'hello.php' ) ); } } diff --git a/tests/phpunit/tests/admin/plugin-dependencies/initialize.php b/tests/phpunit/tests/admin/plugin-dependencies/initialize.php index e83d4d59242ac..375e30c4bd6e2 100644 --- a/tests/phpunit/tests/admin/plugin-dependencies/initialize.php +++ b/tests/phpunit/tests/admin/plugin-dependencies/initialize.php @@ -281,7 +281,11 @@ public function test_should_slugify_dependent_files() { $expected_slugs = array(); foreach ( $plugins as $plugin_file => &$headers ) { // Create the expected slugs. - $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] ); + if ( 'hello.php' === $plugin_file ) { + $slug = 'hello-dolly'; + } else { + $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] ); + } $expected_slugs[ $plugin_file ] = $slug; diff --git a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php b/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php index 794f7215b72d1..08d65879ee0cb 100644 --- a/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php +++ b/tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php @@ -138,7 +138,7 @@ public function test_update_plugin() { $this->_setRole( 'administrator' ); $_POST['_ajax_nonce'] = wp_create_nonce( 'updates' ); - $_POST['plugin'] = 'hello-dolly/hello.php'; + $_POST['plugin'] = 'hello.php'; $_POST['slug'] = 'hello-dolly'; // Prevent wp_update_plugins() from running. @@ -163,7 +163,7 @@ public function test_update_plugin() { 'slug' => 'hello-dolly', 'oldVersion' => 'Version 1.7.2', 'newVersion' => '', - 'plugin' => 'hello-dolly/hello.php', + 'plugin' => 'hello.php', 'pluginName' => 'Hello Dolly', 'debug' => array( 'The plugin is at the latest version.' ), 'errorMessage' => 'The plugin is at the latest version.', diff --git a/tests/phpunit/tests/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index bd4cbd27a49b4..13837cbd0077d 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -3024,7 +3024,7 @@ public function test_wp_set_script_translations_dependency() { * @covers ::wp_enqueue_code_editor */ public function test_wp_enqueue_code_editor_when_php_file_will_be_passed() { - $real_file = WP_PLUGIN_DIR . '/hello-dolly/hello.php'; + $real_file = WP_PLUGIN_DIR . '/hello.php'; $wp_enqueue_code_editor = wp_enqueue_code_editor( array( 'file' => $real_file ) ); $this->assertNonEmptyMultidimensionalArray( $wp_enqueue_code_editor ); diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index f82353c1a2a2d..a5741e91f93f7 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -273,7 +273,7 @@ public function test_get_blog_count_on_different_network() { } public function test_active_network_plugins() { - $path = 'hello-dolly/hello.php'; + $path = 'hello.php'; // Local activate, should be invisible for the network. activate_plugin( $path ); // Enable the plugin for the current site. @@ -285,7 +285,7 @@ public function test_active_network_plugins() { // Activate the plugin sitewide. activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network. $active_plugins = wp_get_active_network_plugins(); - $this->assertSame( array( WP_PLUGIN_DIR . '/hello-dolly/hello.php' ), $active_plugins ); + $this->assertSame( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins ); // Deactivate the plugin. deactivate_plugins( $path ); @@ -304,7 +304,7 @@ public function test_active_network_plugins() { * @ticket 28651 */ public function test_duplicate_network_active_plugin() { - $path = 'hello-dolly/hello.php'; + $path = 'hello.php'; $mock = new MockAction(); add_action( 'activate_' . $path, array( $mock, 'action' ) ); @@ -324,13 +324,13 @@ public function test_duplicate_network_active_plugin() { } public function test_is_plugin_active_for_network_true() { - activate_plugin( 'hello-dolly/hello.php', '', true ); - $this->assertTrue( is_plugin_active_for_network( 'hello-dolly/hello.php' ) ); + activate_plugin( 'hello.php', '', true ); + $this->assertTrue( is_plugin_active_for_network( 'hello.php' ) ); } public function test_is_plugin_active_for_network_false() { - deactivate_plugins( 'hello-dolly/hello.php', false, true ); - $this->assertFalse( is_plugin_active_for_network( 'hello-dolly/hello.php' ) ); + deactivate_plugins( 'hello.php', false, true ); + $this->assertFalse( is_plugin_active_for_network( 'hello.php' ) ); } public function helper_deactivate_hook() { From c8d8d016e9d80934eaa183cd32fd2c3a06bd9c78 Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 21 Oct 2025 14:43:57 +1100 Subject: [PATCH 6/7] Retain ABSPATH logic check. --- src/wp-content/plugins/hello.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello.php index ff55908342290..e10ecb3b24e9f 100644 --- a/src/wp-content/plugins/hello.php +++ b/src/wp-content/plugins/hello.php @@ -12,6 +12,11 @@ Author URI: http://ma.tt/ */ +// Do not load directly. +if ( ! defined( 'ABSPATH' ) ) { + die(); +} + function hello_dolly_get_lyric() { /** These are the lyrics to Hello Dolly */ $lyrics = "Hello, Dolly From 0bb3ffde1a49c869f400f9d00bc752a6dbd129ff Mon Sep 17 00:00:00 2001 From: Peter Wilson Date: Tue, 21 Oct 2025 14:59:00 +1100 Subject: [PATCH 7/7] No, Peter, No. --- src/wp-admin/includes/upgrade.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/includes/upgrade.php b/src/wp-admin/includes/upgrade.php index 95f090af9f7b1..c8235c314f431 100644 --- a/src/wp-admin/includes/upgrade.php +++ b/src/wp-admin/includes/upgrade.php @@ -2414,6 +2414,7 @@ function upgrade_650() { wp_set_option_autoload_values( $autoload ); } } + /** * Executes changes made in WordPress 6.7.0. * @@ -2932,8 +2933,10 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N // Create a tablename index for an array ($cqueries) of recognized query types. foreach ( $queries as $qry ) { if ( preg_match( '|CREATE TABLE ([^ ]*)|', $qry, $matches ) ) { - $cqueries[ trim( $matches[1], '`' ) ] = $qry; - $for_update[ $matches[1] ] = 'Created table ' . $matches[1]; + $table_name = trim( $matches[1], '`' ); + + $cqueries[ $table_name ] = $qry; + $for_update[ $table_name ] = 'Created table ' . $matches[1]; continue; } @@ -3171,7 +3174,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N $fieldtype_base = strtok( $fieldtype_without_parentheses, ' ' ); // Is actual field type different from the field type in query? - if ( $tablefield->Type !== $fieldtype ) { + if ( $tablefield->Type !== $fieldtype_lowercased ) { $do_change = true; if ( in_array( $fieldtype_lowercased, $text_fields, true ) && in_array( $tablefield_type_lowercased, $text_fields, true ) ) { if ( array_search( $fieldtype_lowercased, $text_fields, true ) < array_search( $tablefield_type_lowercased, $text_fields, true ) ) { @@ -3250,7 +3253,7 @@ function dbDelta( $queries = '', $execute = true ) { // phpcs:ignore WordPress.N 'fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part, ); - $index_ary[ $keyname ]['unique'] = ( '0' === $tableindex->Non_unique ) ? true : false; + $index_ary[ $keyname ]['unique'] = ( '0' === (string) $tableindex->Non_unique ) ? true : false; $index_ary[ $keyname ]['index_type'] = $tableindex->Index_type; }