Make WordPress Core

Ticket #53323: 53323.diff

File 53323.diff, 12.9 KB (added by whyisjake, 3 months ago)
  • .gitignore

     
    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

     
    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

     
    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 ) {
     
    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

     
    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/**
     
    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

     
    880880
    881881        if ( $wp_current_db_version < 58975 ) {
    882882                upgrade_670();
     883                upgrade_690();
    883884        }
    884885
    885886        if ( $wp_current_db_version < 60421 ) {
     
    24142415                wp_set_option_autoload_values( $autoload );
    24152416        }
    24162417}
     2418
    24172419/**
     2420 * Executes changes made in WordPress 6.9.0.
     2421 *
     2422 * @ignore
     2423 * @since 6.9.0
     2424 *
     2425 * @global int $wp_current_db_version The old (current) database version.
     2426 */
     2427function upgrade_690() {
     2428        global $wp_current_db_version;
     2429
     2430        // Switch Hello Dolly from file to directory format. See #53323
     2431        $active_plugins = get_option( 'active_plugins' );
     2432        $old_plugin     = 'hello.php';
     2433        $new_plugin     = 'hello-dolly/hello.php';
     2434        $key            = array_search( $old_plugin, $active_plugins, true );
     2435
     2436        if ( $key ) {
     2437                $active_plugins[ $key ] = $new_plugin;
     2438                update_option( 'active_plugins', $active_plugins );
     2439        }
     2440}
     2441/**
    24182442 * Executes changes made in WordPress 6.7.0.
    24192443 *
    24202444 * @ignore
  • src/wp-content/plugins/hello.php

     
    1010Author: Matt Mullenweg
    1111Version: 1.7.2
    1212Author URI: http://ma.tt/
     13Text Domain: hello-dolly
    1314*/
    1415
    1516// Do not load directly.
  • src/wp-includes/class-wp-plugin-dependencies.php

     
    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}
  • tests/phpunit/tests/admin/includesPlugin.php

     
    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',
     
    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
     
    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        /**
     
    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 );
     
    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

     
    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}
  • tests/phpunit/tests/admin/plugin-dependencies/initialize.php

     
    281281                $expected_slugs = array();
    282282                foreach ( $plugins as $plugin_file => &$headers ) {
    283283                        // Create the expected slugs.
    284                         if ( 'hello.php' === $plugin_file ) {
    285                                 $slug = 'hello-dolly';
    286                         } else {
    287                                 $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] );
    288                         }
     284                        $slug = str_replace( '.php', '', explode( '/', $plugin_file )[0] );
    289285
    290286                        $expected_slugs[ $plugin_file ] = $slug;
    291287
  • tests/phpunit/tests/ajax/wpAjaxUpdatePlugin.php

     
    138138                $this->_setRole( 'administrator' );
    139139
    140140                $_POST['_ajax_nonce'] = wp_create_nonce( 'updates' );
    141                 $_POST['plugin']      = 'hello.php';
     141                $_POST['plugin']      = 'hello-dolly/hello.php';
    142142                $_POST['slug']        = 'hello-dolly';
    143143
    144144                // Prevent wp_update_plugins() from running.
     
    163163                                'slug'         => 'hello-dolly',
    164164                                'oldVersion'   => 'Version 1.7.2',
    165165                                'newVersion'   => '',
    166                                 'plugin'       => 'hello.php',
     166                                'plugin'       => 'hello-dolly/hello.php',
    167167                                'pluginName'   => 'Hello Dolly',
    168168                                'debug'        => array( 'The plugin is at the latest version.' ),
    169169                                'errorMessage' => 'The plugin is at the latest version.',
  • tests/phpunit/tests/dependencies/scripts.php

     
    26242624         * @covers ::wp_enqueue_code_editor
    26252625         */
    26262626        public function test_wp_enqueue_code_editor_when_php_file_will_be_passed() {
    2627                 $real_file              = WP_PLUGIN_DIR . '/hello.php';
     2627                $real_file              = WP_PLUGIN_DIR . '/hello-dolly/hello.php';
    26282628                $wp_enqueue_code_editor = wp_enqueue_code_editor( array( 'file' => $real_file ) );
    26292629                $this->assertNonEmptyMultidimensionalArray( $wp_enqueue_code_editor );
    26302630
  • tests/phpunit/tests/multisite/network.php

     
    269269        }
    270270
    271271        public function test_active_network_plugins() {
    272                 $path = 'hello.php';
     272                $path = 'hello-dolly/hello.php';
    273273
    274274                // Local activate, should be invisible for the network.
    275275                activate_plugin( $path ); // Enable the plugin for the current site.
     
    281281                // Activate the plugin sitewide.
    282282                activate_plugin( $path, '', true ); // Enable the plugin for all sites in the network.
    283283                $active_plugins = wp_get_active_network_plugins();
    284                 $this->assertSame( array( WP_PLUGIN_DIR . '/hello.php' ), $active_plugins );
     284                $this->assertSame( array( WP_PLUGIN_DIR . '/hello-dolly/hello.php' ), $active_plugins );
    285285
    286286                // Deactivate the plugin.
    287287                deactivate_plugins( $path );
     
    300300         * @ticket 28651
    301301         */
    302302        public function test_duplicate_network_active_plugin() {
    303                 $path = 'hello.php';
     303                $path = 'hello-dolly/hello.php';
    304304                $mock = new MockAction();
    305305                add_action( 'activate_' . $path, array( $mock, 'action' ) );
    306306
     
    320320        }
    321321
    322322        public function test_is_plugin_active_for_network_true() {
    323                 activate_plugin( 'hello.php', '', true );
    324                 $this->assertTrue( is_plugin_active_for_network( 'hello.php' ) );
     323                activate_plugin( 'hello-dolly/hello.php', '', true );
     324                $this->assertTrue( is_plugin_active_for_network( 'hello-dolly/hello.php' ) );
    325325        }
    326326
    327327        public function test_is_plugin_active_for_network_false() {
    328                 deactivate_plugins( 'hello.php', false, true );
    329                 $this->assertFalse( is_plugin_active_for_network( 'hello.php' ) );
     328                deactivate_plugins( 'hello-dolly/hello.php', false, true );
     329                $this->assertFalse( is_plugin_active_for_network( 'hello-dolly/hello.php' ) );
    330330        }
    331331
    332332        public function helper_deactivate_hook() {
  • .