diff --git a/.gitignore b/.gitignore index 58af6fe2fc10d..01314e1a67139 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 216dbfae64945..70fb474ab9fdc 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 ee1970ea389a8..300edff42fb1f 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..c8235c314f431 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(); @@ -2485,31 +2481,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. * diff --git a/src/wp-content/plugins/hello-dolly/hello.php b/src/wp-content/plugins/hello.php similarity index 99% rename from src/wp-content/plugins/hello-dolly/hello.php rename to src/wp-content/plugins/hello.php index f820405da93e4..e10ecb3b24e9f 100644 --- a/src/wp-content/plugins/hello-dolly/hello.php +++ b/src/wp-content/plugins/hello.php @@ -10,7 +10,6 @@ Author: Matt Mullenweg Version: 1.7.2 Author URI: http://ma.tt/ -Text Domain: hello-dolly */ // Do not load directly. 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 c8059b4d4d7c5..fec0d032227c7 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -2994,7 +2994,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() {