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 83a31a9cd309c..33939e5a8dfee 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 f1731f9c8f33a..7bdc1aaa3115b 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-content/plugins/hello.php b/src/wp-content/plugins/hello-dolly/hello.php similarity index 99% rename from src/wp-content/plugins/hello.php rename to src/wp-content/plugins/hello-dolly/hello.php index e10ecb3b24e9f..f820405da93e4 100644 --- a/src/wp-content/plugins/hello.php +++ b/src/wp-content/plugins/hello-dolly/hello.php @@ -10,6 +10,7 @@ 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 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 e95697810d43f..74b3175ac1ab0 100644 --- a/tests/phpunit/tests/admin/includesPlugin.php +++ b/tests/phpunit/tests/admin/includesPlugin.php @@ -13,7 +13,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', @@ -365,38 +365,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 ) ); } @@ -541,7 +541,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' ) ); } /** @@ -561,7 +561,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 ); @@ -571,7 +571,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/dependencies/scripts.php b/tests/phpunit/tests/dependencies/scripts.php index 89bfb4ef922e6..428331a2a7ce8 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -2502,7 +2502,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.php'; + $real_file = WP_PLUGIN_DIR . '/hello-dolly/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 3a5babfe0c37f..43e45990134b9 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -269,7 +269,7 @@ public function test_get_blog_count_on_different_network() { } public function test_active_network_plugins() { - $path = 'hello.php'; + $path = 'hello-dolly/hello.php'; // Local activate, should be invisible for the network. activate_plugin( $path ); // Enable the plugin for the current site. @@ -281,7 +281,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.php' ), $active_plugins ); + $this->assertSame( array( WP_PLUGIN_DIR . '/hello-dolly/hello.php' ), $active_plugins ); // Deactivate the plugin. deactivate_plugins( $path ); @@ -300,7 +300,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' ) ); @@ -320,13 +320,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() {