Make WordPress Core

Ticket #59375: 59375.diff

File 59375.diff, 916 bytes (added by michelleblanchette, 15 months ago)

Initial GitHub Pull Request patch diff

  • src/wp-admin/includes/class-plugin-upgrader.php

    diff --git a/src/wp-admin/includes/class-plugin-upgrader.php b/src/wp-admin/includes/class-plugin-upgrader.php
    index 02743f64561e..56de405edffc 100644
    a b public function plugin_info() { 
    544544                }
    545545
    546546                // Assume the requested plugin is the first in the list.
    547                 $pluginfiles = array_keys( $plugin );
     547                $pluginfile = array_keys( $plugin )[0];
     548
     549                if ( false !== strpos( $pluginfile, '/' ) ) {
     550                        // Prefer first top-level file to remain consistent with
     551                        // get_plugins() default behavior with WP_PLUGIN_DIR.
     552                        foreach ( $plugin as $file => &$data ) {
     553                                if ( false === strpos( $file, '/' ) ) {
     554                                        $pluginfile = $file;
     555                                }
     556                        }
     557                }
    548558
    549                 return $this->result['destination_name'] . '/' . $pluginfiles[0];
     559                return $this->result['destination_name'] . '/' . $pluginfile;
    550560        }
    551561
    552562        /**