Upgrade/Install: Move Hello Dolly plugin to directory structure.

Changes the Hello Dolly plugin from a single file structure to a proper plugin directory structure, moving from `hello.php` to `hello-dolly/hello.php` to align with Plugin Handbook Best Practices.

- Adds proper `Text Domain: hello-dolly` header to Hello Dolly plugin
- Updates core files to remove special case handling for `hello.php`
- Updates plugin dependency system to handle new directory structure
- Adds upgrade routine to migrate active plugin references and keep plugin active
- Updates all tests to use new plugin path format `hello-dolly/hello.php`
- Updates build configuration and .gitignore for new directory structure
- Adds `hello.php` to old files list for cleanup during core updates
- Adds `plugins/hello-dolly/` to new bundled directories list

Props afragen, SergeyBiryukov, peterwilsoncc, SirLouen, matt, davidbaumwald, desrosj, hellofromtonya, justinahinon,audrasjb, oglekler, whyisjake.
Fixes #53323.


Built from https://develop.svn.wordpress.org/trunk@60666


git-svn-id: http://core.svn.wordpress.org/trunk@60002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
whyisjake
2025-08-26 18:41:31 +00:00
parent 6096e1d2e5
commit f8f84a4173
6 changed files with 28 additions and 115 deletions

View File

@@ -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 ];

View File

@@ -841,6 +841,8 @@ $_old_files = array(
'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 @@ $_new_bundled_files = array(
'themes/twentytwentythree/' => '6.1',
'themes/twentytwentyfour/' => '6.4',
'themes/twentytwentyfive/' => '6.7',
'plugins/hello-dolly/' => '6.9',
);
/**

View File

@@ -880,6 +880,7 @@ function upgrade_all() {
if ( $wp_current_db_version < 58975 ) {
upgrade_670();
upgrade_690();
}
if ( $wp_current_db_version < 60421 ) {
@@ -2414,6 +2415,29 @@ function upgrade_650() {
wp_set_option_autoload_values( $autoload );
}
}
/**
* 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;
// 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 );
}
}
/**
* Executes changes made in WordPress 6.7.0.
*

View File

@@ -1,105 +0,0 @@
<?php
/**
* @package Hello_Dolly
* @version 1.7.2
*/
/*
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Author: Matt Mullenweg
Version: 1.7.2
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
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(
'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
__( '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 "
<style type='text/css'>
#dolly {
float: right;
padding: 5px 10px;
margin: 0;
font-size: 12px;
line-height: 1.6666;
}
.rtl #dolly {
float: left;
}
.block-editor-page #dolly {
display: none;
}
@media screen and (max-width: 782px) {
#dolly,
.rtl #dolly {
float: none;
padding-left: 0;
padding-right: 0;
}
}
</style>
";
}
add_action( 'admin_head', 'dolly_css' );

View File

@@ -870,9 +870,6 @@ class WP_Plugin_Dependencies {
* @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 );
}
}

View File

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