Skip to content

Commit 9762fdf

Browse files
committed
clean the branch
1 parent 41cbe41 commit 9762fdf

File tree

17 files changed

+171
-48
lines changed

17 files changed

+171
-48
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ wp-tests-config.php
5050
/src/wp-content/fonts
5151
/src/wp-content/languages
5252
/src/wp-content/mu-plugins
53-
/src/wp-content/plugins
53+
/src/wp-content/plugins/*
54+
!/src/wp-content/plugins/hello-dolly
5455
/src/wp-content/themes/*
5556
!/src/wp-content/themes/twentyten
5657
!/src/wp-content/themes/twentyeleven

Gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ module.exports = function(grunt) {
2828
'wp-content/themes/index.php',
2929
'wp-content/themes/twenty*/**',
3030
'wp-content/plugins/index.php',
31-
'wp-content/plugins/hello.php',
31+
'wp-content/plugins/hello-dolly/**',
3232
'wp-content/plugins/akismet/**',
3333
'!wp-content/themes/twenty*/node_modules/**',
3434
],

src/wp-admin/includes/plugin.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,6 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup
153153
load_plugin_textdomain( $textdomain, false, dirname( $plugin_file ) );
154154
}
155155
}
156-
} elseif ( 'hello.php' === basename( $plugin_file ) ) {
157-
$textdomain = 'default';
158156
}
159157
if ( $textdomain ) {
160158
foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) {
@@ -1008,10 +1006,6 @@ function delete_plugins( $plugins, $deprecated = '' ) {
10081006

10091007
$plugin_slug = dirname( $plugin_file );
10101008

1011-
if ( 'hello.php' === $plugin_file ) {
1012-
$plugin_slug = 'hello-dolly';
1013-
}
1014-
10151009
// Remove language files, silently.
10161010
if ( '.' !== $plugin_slug && ! empty( $plugin_translations[ $plugin_slug ] ) ) {
10171011
$translations = $plugin_translations[ $plugin_slug ];

src/wp-admin/includes/update-core.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,8 @@
841841
'wp-includes/js/dist/undo-manager.min.js',
842842
'wp-includes/js/dist/fields.min.js',
843843
'wp-includes/js/dist/fields.js',
844+
// 6.9
845+
'wp-content/plugins/hello.php',
844846
);
845847

846848
/**
@@ -973,6 +975,7 @@
973975
'themes/twentytwentythree/' => '6.1',
974976
'themes/twentytwentyfour/' => '6.4',
975977
'themes/twentytwentyfive/' => '6.7',
978+
'plugins/hello-dolly/' => '6.9',
976979
);
977980

978981
/**

src/wp-admin/includes/upgrade.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,10 @@ function upgrade_all() {
886886
upgrade_682();
887887
}
888888

889+
if ( $wp_current_db_version < 60717 ) {
890+
upgrade_690();
891+
}
892+
889893
maybe_disable_link_manager();
890894

891895
maybe_disable_automattic_widgets();
@@ -2414,6 +2418,7 @@ function upgrade_650() {
24142418
wp_set_option_autoload_values( $autoload );
24152419
}
24162420
}
2421+
24172422
/**
24182423
* Executes changes made in WordPress 6.7.0.
24192424
*
@@ -2480,6 +2485,31 @@ function ( $url ) {
24802485
}
24812486
}
24822487

2488+
/**
2489+
* Executes changes made in WordPress 6.9.0.
2490+
*
2491+
* @ignore
2492+
* @since 6.9.0
2493+
*
2494+
* @global int $wp_current_db_version The old (current) database version.
2495+
*/
2496+
function upgrade_690() {
2497+
global $wp_current_db_version;
2498+
2499+
if ( $wp_current_db_version < 60717 ) {
2500+
// Switch Hello Dolly from file to directory format. See #53323
2501+
$active_plugins = (array) get_option( 'active_plugins', array() );
2502+
$old_plugin = 'hello.php';
2503+
$new_plugin = 'hello-dolly/hello.php';
2504+
$key = array_search( $old_plugin, $active_plugins, true );
2505+
2506+
if ( $key ) {
2507+
$active_plugins[ $key ] = $new_plugin;
2508+
update_option( 'active_plugins', $active_plugins );
2509+
}
2510+
}
2511+
}
2512+
24832513
/**
24842514
* Executes network-level upgrade routines.
24852515
*
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
<?php
2+
/**
3+
* @package Hello_Dolly
4+
* @version 1.7.2
5+
*/
6+
/*
7+
Plugin Name: Hello Dolly
8+
Plugin URI: http://wordpress.org/plugins/hello-dolly/
9+
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.
10+
Author: Matt Mullenweg
11+
Version: 1.7.2
12+
Author URI: http://ma.tt/
13+
Text Domain: hello-dolly
14+
*/
15+
16+
// Do not load directly.
17+
if ( ! defined( 'ABSPATH' ) ) {
18+
die();
19+
}
20+
21+
function hello_dolly_get_lyric() {
22+
/** These are the lyrics to Hello Dolly */
23+
$lyrics = "Hello, Dolly
24+
Well, hello, Dolly
25+
It's so nice to have you back where you belong
26+
You're lookin' swell, Dolly
27+
I can tell, Dolly
28+
You're still glowin', you're still crowin'
29+
You're still goin' strong
30+
I feel the room swayin'
31+
While the band's playin'
32+
One of our old favorite songs from way back when
33+
So, take her wrap, fellas
34+
Dolly, never go away again
35+
Hello, Dolly
36+
Well, hello, Dolly
37+
It's so nice to have you back where you belong
38+
You're lookin' swell, Dolly
39+
I can tell, Dolly
40+
You're still glowin', you're still crowin'
41+
You're still goin' strong
42+
I feel the room swayin'
43+
While the band's playin'
44+
One of our old favorite songs from way back when
45+
So, golly, gee, fellas
46+
Have a little faith in me, fellas
47+
Dolly, never go away
48+
Promise, you'll never go away
49+
Dolly'll never go away again";
50+
51+
// Here we split it into lines.
52+
$lyrics = explode( "\n", $lyrics );
53+
54+
// And then randomly choose a line.
55+
return wptexturize( $lyrics[ mt_rand( 0, count( $lyrics ) - 1 ) ] );
56+
}
57+
58+
// This just echoes the chosen line, we'll position it later.
59+
function hello_dolly() {
60+
$chosen = hello_dolly_get_lyric();
61+
$lang = '';
62+
if ( 'en_' !== substr( get_user_locale(), 0, 3 ) ) {
63+
$lang = ' lang="en"';
64+
}
65+
66+
printf(
67+
'<p id="dolly"><span class="screen-reader-text">%s </span><span dir="ltr"%s>%s</span></p>',
68+
__( 'Quote from Hello Dolly song, by Jerry Herman:' ),
69+
$lang,
70+
$chosen
71+
);
72+
}
73+
74+
// Now we set that function up to execute when the admin_notices action is called.
75+
add_action( 'admin_notices', 'hello_dolly' );
76+
77+
// We need some CSS to position the paragraph.
78+
function dolly_css() {
79+
echo "
80+
<style type='text/css'>
81+
#dolly {
82+
float: right;
83+
padding: 5px 10px;
84+
margin: 0;
85+
font-size: 12px;
86+
line-height: 1.6666;
87+
}
88+
.rtl #dolly {
89+
float: left;
90+
}
91+
.block-editor-page #dolly {
92+
display: none;
93+
}
94+
@media screen and (max-width: 782px) {
95+
#dolly,
96+
.rtl #dolly {
97+
float: none;
98+
padding-left: 0;
99+
padding-right: 0;
100+
}
101+
}
102+
</style>
103+
";
104+
}
105+
106+
add_action( 'admin_head', 'dolly_css' );

src/wp-includes/class-wp-plugin-dependencies.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -870,9 +870,6 @@ protected static function check_for_circular_dependencies( $dependents, $depende
870870
* @return string The plugin's slug.
871871
*/
872872
protected static function convert_to_slug( $plugin_file ) {
873-
if ( 'hello.php' === $plugin_file ) {
874-
return 'hello-dolly';
875-
}
876873
return str_contains( $plugin_file, '/' ) ? dirname( $plugin_file ) : str_replace( '.php', '', $plugin_file );
877874
}
878875
}
File renamed without changes.

tests/phpunit/tests/admin/includesPlugin.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static function wpTearDownAfterClass() {
2222
}
2323

2424
public function test_get_plugin_data() {
25-
$data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
25+
$data = get_plugin_data( DIR_TESTDATA . '/plugins/hello-dolly/hello.php' );
2626

2727
$default_headers = array(
2828
'Name' => 'Hello Dolly',
@@ -374,38 +374,38 @@ public function test_passing_float_as_position_does_not_override_int() {
374374
}
375375

376376
public function test_is_plugin_active_true() {
377-
activate_plugin( 'hello.php' );
378-
$test = is_plugin_active( 'hello.php' );
377+
activate_plugin( 'hello-dolly/hello.php' );
378+
$test = is_plugin_active( 'hello-dolly/hello.php' );
379379
$this->assertTrue( $test );
380380

381-
deactivate_plugins( 'hello.php' );
381+
deactivate_plugins( 'hello-dolly/hello.php' );
382382
}
383383

384384
public function test_is_plugin_active_false() {
385-
deactivate_plugins( 'hello.php' );
386-
$test = is_plugin_active( 'hello.php' );
385+
deactivate_plugins( 'hello-dolly/hello.php' );
386+
$test = is_plugin_active( 'hello-dolly/hello.php' );
387387
$this->assertFalse( $test );
388388
}
389389

390390
public function test_is_plugin_inactive_true() {
391-
deactivate_plugins( 'hello.php' );
392-
$test = is_plugin_inactive( 'hello.php' );
391+
deactivate_plugins( 'hello-dolly/hello.php' );
392+
$test = is_plugin_inactive( 'hello-dolly/hello.php' );
393393
$this->assertTrue( $test );
394394
}
395395

396396
public function test_is_plugin_inactive_false() {
397-
activate_plugin( 'hello.php' );
398-
$test = is_plugin_inactive( 'hello.php' );
397+
activate_plugin( 'hello-dolly/hello.php' );
398+
$test = is_plugin_inactive( 'hello-dolly/hello.php' );
399399
$this->assertFalse( $test );
400400

401-
deactivate_plugins( 'hello.php' );
401+
deactivate_plugins( 'hello-dolly/hello.php' );
402402
}
403403

404404
/**
405405
* @covers ::get_plugin_files
406406
*/
407407
public function test_get_plugin_files_single() {
408-
$name = 'hello.php';
408+
$name = 'hello-dolly/hello.php';
409409
$this->assertSame( array( $name ), get_plugin_files( $name ) );
410410
}
411411

@@ -550,7 +550,7 @@ public function test_get_dropins_not_empty() {
550550
* @covers ::is_network_only_plugin
551551
*/
552552
public function test_is_network_only_plugin_hello() {
553-
$this->assertFalse( is_network_only_plugin( 'hello.php' ) );
553+
$this->assertFalse( is_network_only_plugin( 'hello-dolly/hello.php' ) );
554554
}
555555

556556
/**
@@ -570,7 +570,7 @@ public function test_is_network_only_plugin() {
570570
* @covers ::activate_plugins
571571
*/
572572
public function test_activate_plugins_single_no_array() {
573-
$name = 'hello.php';
573+
$name = 'hello-dolly/hello.php';
574574
activate_plugins( $name );
575575
$this->assertTrue( is_plugin_active( $name ) );
576576
deactivate_plugins( $name );
@@ -580,7 +580,7 @@ public function test_activate_plugins_single_no_array() {
580580
* @covers ::activate_plugins
581581
*/
582582
public function test_activate_plugins_single_array() {
583-
$name = 'hello.php';
583+
$name = 'hello-dolly/hello.php';
584584
activate_plugins( array( $name ) );
585585
$this->assertTrue( is_plugin_active( $name ) );
586586
deactivate_plugins( $name );

tests/phpunit/tests/admin/plugin-dependencies/hasDependents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,6 @@ public function test_should_return_false_when_a_plugin_has_no_dependents() {
5353
*/
5454
public function test_should_convert_hellophp_to_hello_dolly() {
5555
$this->set_property_value( 'dependency_slugs', array( 'hello-dolly' ) );
56-
$this->assertTrue( self::$instance::has_dependents( 'hello.php' ) );
56+
$this->assertTrue( self::$instance::has_dependents( 'hello-dolly/hello.php' ) );
5757
}
5858
}

0 commit comments

Comments
 (0)