Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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/**',
],
Expand Down
6 changes: 6 additions & 0 deletions src/wp-admin/includes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ];
Expand Down
3 changes: 0 additions & 3 deletions src/wp-admin/includes/update-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);

/**
Expand Down Expand Up @@ -975,7 +973,6 @@
'themes/twentytwentythree/' => '6.1',
'themes/twentytwentyfour/' => '6.4',
'themes/twentytwentyfive/' => '6.7',
'plugins/hello-dolly/' => '6.9',
);

/**
Expand Down
29 changes: 0 additions & 29 deletions src/wp-admin/includes/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Author: Matt Mullenweg
Version: 1.7.2
Author URI: http://ma.tt/
Text Domain: hello-dolly
*/

// Do not load directly.
Expand Down
3 changes: 3 additions & 0 deletions src/wp-includes/class-wp-plugin-dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
30 changes: 15 additions & 15 deletions tests/phpunit/tests/admin/includesPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 ) );
}

Expand Down Expand Up @@ -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' ) );
}

/**
Expand All @@ -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 );
Expand All @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
}
}
6 changes: 5 additions & 1 deletion tests/phpunit/tests/admin/plugin-dependencies/initialize.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.',
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/tests/dependencies/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
14 changes: 7 additions & 7 deletions tests/phpunit/tests/multisite/network.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 );
Expand All @@ -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' ) );

Expand All @@ -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() {
Expand Down
Loading