From e9c88a6d18f7616fac8b319263336eb19c826738 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 2 Jun 2021 17:13:29 -0700 Subject: [PATCH 01/13] use containing folder, just like guidelines suggest --- src/wp-content/plugins/{ => hello-dolly}/hello.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/wp-content/plugins/{ => hello-dolly}/hello.php (100%) diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello-dolly/hello.php similarity index 100% rename from src/wp-content/plugins/hello.php rename to src/wp-content/plugins/hello-dolly/hello.php From d4c5285eaa08865ff321910ed2ad018139b1ae14 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 2 Jun 2021 17:53:46 -0700 Subject: [PATCH 02/13] update tests for path --- tests/phpunit/tests/admin/includesPlugin.php | 30 ++++++++++---------- tests/phpunit/tests/ajax/UpdatePlugin.php | 4 +-- tests/phpunit/tests/dependencies/scripts.php | 2 +- tests/phpunit/tests/multisite/network.php | 14 ++++----- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php index cbbc181b460f1..260dabf218b57 100644 --- a/tests/phpunit/tests/admin/includesPlugin.php +++ b/tests/phpunit/tests/admin/includesPlugin.php @@ -13,7 +13,7 @@ public static function wpTearDownAfterClass() { } 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', @@ -333,38 +333,38 @@ function test_passing_string_as_position_fires_doing_it_wrong() { } 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' ); } 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 ); } 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 ); } 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 ) ); } @@ -508,7 +508,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' ) ); } /** @@ -526,7 +526,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 ); @@ -536,7 +536,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/ajax/UpdatePlugin.php b/tests/phpunit/tests/ajax/UpdatePlugin.php index ceab32bfeb451..ad35b20735657 100644 --- a/tests/phpunit/tests/ajax/UpdatePlugin.php +++ b/tests/phpunit/tests/ajax/UpdatePlugin.php @@ -134,7 +134,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'; // Make the request. @@ -157,7 +157,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 533704ed09d77..8e1e36b5b82ad 100644 --- a/tests/phpunit/tests/dependencies/scripts.php +++ b/tests/phpunit/tests/dependencies/scripts.php @@ -1057,7 +1057,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 3742baf959525..f736114a3d3af 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -263,7 +263,7 @@ function test_enable_live_network_user_counts_filter() { } 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. @@ -275,7 +275,7 @@ 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 ); @@ -294,7 +294,7 @@ function test_active_network_plugins() { * @ticket 28651 */ function test_duplicate_network_active_plugin() { - $path = 'hello.php'; + $path = 'hello-dolly/hello.php'; $mock = new MockAction(); add_action( 'activate_' . $path, array( $mock, 'action' ) ); @@ -314,13 +314,13 @@ function test_duplicate_network_active_plugin() { } 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' ) ); } 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' ) ); } function _helper_deactivate_hook() { From 1fd20c32621472254b88923c65af0da8f5fda2ea Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 2 Jun 2021 17:59:48 -0700 Subject: [PATCH 03/13] update in test data --- 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.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 From 75f4ecab485e317c01d5b66af09cda5ba551d344 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Thu, 3 Jun 2021 09:01:38 -0700 Subject: [PATCH 04/13] per Sergey's suggestion --- src/wp-admin/includes/update-core.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 37c2c287a4fe5..7374a2a3da271 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -803,6 +803,8 @@ 'wp-includes/js/jquery/ui/widget.min.js', // 5.7 'wp-includes/blocks/classic/block.json', + // 5.8 + 'wp-content/plugins/hello.php', ); /** From 4647eab301b5459d514f913df92c4cbd10fcc496 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jun 2021 10:37:54 -0700 Subject: [PATCH 05/13] remove core workarounds for not having containing folder --- src/wp-admin/includes/plugin.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index ce913919da6e6..1dad26dfd381e 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -1001,10 +1001,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 ]; From 129864b05e23dc28a19bd1eb08460bb031d6d80f Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 8 Jun 2021 10:38:15 -0700 Subject: [PATCH 06/13] add Text Domain to plugin --- src/wp-admin/includes/plugin.php | 2 -- src/wp-content/plugins/hello-dolly/hello.php | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-admin/includes/plugin.php b/src/wp-admin/includes/plugin.php index 1dad26dfd381e..cd9e1d212a850 100644 --- a/src/wp-admin/includes/plugin.php +++ b/src/wp-admin/includes/plugin.php @@ -159,8 +159,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 ) { diff --git a/src/wp-content/plugins/hello-dolly/hello.php b/src/wp-content/plugins/hello-dolly/hello.php index ff55908342290..09c18b8796ce2 100644 --- a/src/wp-content/plugins/hello-dolly/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 */ function hello_dolly_get_lyric() { From 549d1ac67fb37086959008aeeff5d3750254072f Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Fri, 3 Mar 2023 12:01:55 -0800 Subject: [PATCH 07/13] update for test --- tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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.', From dfefa2ac1fe258176f032c98864af9d834423c3f Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Thu, 20 Jun 2024 10:29:21 -0700 Subject: [PATCH 08/13] update for more recent "fixes" for single file plugin --- src/wp-includes/class-wp-plugin-dependencies.php | 3 --- .../tests/admin/plugin-dependencies/hasDependents.php | 2 +- .../phpunit/tests/admin/plugin-dependencies/initialize.php | 6 +----- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/class-wp-plugin-dependencies.php b/src/wp-includes/class-wp-plugin-dependencies.php index 0850ffd2a29d8..d133ac19946dc 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/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; From 3caaed003f940b66bf79ad4e930c3b9c32ba3e2f Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Thu, 20 Jun 2024 10:33:37 -0700 Subject: [PATCH 09/13] build with containing folder --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index a99dcb4104aa1..d3c8b9e99b81f 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/**', ], From 0e4e1f774c95db6e0a63dbe7a6f672660136e16c Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 21 May 2025 10:52:59 -0700 Subject: [PATCH 10/13] fix merge --- tests/phpunit/tests/multisite/network.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/phpunit/tests/multisite/network.php b/tests/phpunit/tests/multisite/network.php index 196d6e502b876..43e45990134b9 100644 --- a/tests/phpunit/tests/multisite/network.php +++ b/tests/phpunit/tests/multisite/network.php @@ -265,8 +265,6 @@ public function test_get_blog_count_on_different_network() { $site_count = get_blog_count( self::$different_network_id ); - public function test_active_network_plugins() { - $path = 'hello-dolly/hello.php'; $this->assertEquals( count( self::$different_site_ids ), $site_count ); } From 06a0d97ce09bfd22d1ce67944c74c817c62fe208 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Wed, 21 May 2025 11:19:02 -0700 Subject: [PATCH 11/13] spaces to tab --- src/wp-admin/includes/update-core.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index 4dc24fab25466..ee16cde0ef2e0 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -841,7 +841,7 @@ 'wp-includes/js/dist/undo-manager.min.js', 'wp-includes/js/dist/fields.min.js', 'wp-includes/js/dist/fields.js', - // 6.9 + // 6.9 'wp-content/plugins/hello.php', ); From ef74bb1641fc08a2b01d7a36b5cdfd5f718a795f Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 27 May 2025 16:44:18 -0700 Subject: [PATCH 12/13] add for 6.9 --- src/wp-admin/includes/update-core.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/wp-admin/includes/update-core.php b/src/wp-admin/includes/update-core.php index ee16cde0ef2e0..7bdc1aaa3115b 100644 --- a/src/wp-admin/includes/update-core.php +++ b/src/wp-admin/includes/update-core.php @@ -975,6 +975,7 @@ 'themes/twentytwentythree/' => '6.1', 'themes/twentytwentyfour/' => '6.4', 'themes/twentytwentyfive/' => '6.7', + 'plugins/hello-dolly/' => '6.9', ); /** From ce8522db602b10f5d4ae9ea9ccb68fe251001e86 Mon Sep 17 00:00:00 2001 From: Andy Fragen Date: Tue, 27 May 2025 17:03:05 -0700 Subject: [PATCH 13/13] update .gitignore for hello-dolly --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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