WordPress.org

Make WordPress Core

Ticket #35956: 35956_alldeps2.diff

File 35956_alldeps2.diff, 2.6 KB (added by stephenharris, 6 years ago)

Ensure script's group is passed onto its dependencies. Reverts 36604

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

    diff --git src/wp-includes/class.wp-dependencies.php src/wp-includes/class.wp-dependencies.php
    index 31bc84d..8954023 100644
    class WP_Dependencies { 
    154154                                continue;
    155155
    156156                        $moved = $this->set_group( $handle, $recursion, $group );
     157                        $_group = $this->groups[$handle];
    157158
    158159                        if ( $queued && !$moved ) // already queued and in the right group
    159160                                continue;
    class WP_Dependencies { 
    163164                                $keep_going = false; // Item doesn't exist.
    164165                        elseif ( $this->registered[$handle]->deps && array_diff($this->registered[$handle]->deps, array_keys($this->registered)) )
    165166                                $keep_going = false; // Item requires dependencies that don't exist.
    166                         elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $group ) )
     167                        elseif ( $this->registered[$handle]->deps && !$this->all_deps( $this->registered[$handle]->deps, true, $_group ) )
    167168                                $keep_going = false; // Item requires dependencies that don't exist.
    168169
    169170                        if ( ! $keep_going ) { // Either item or its dependencies don't exist.
    class WP_Dependencies { 
    384385        public function set_group( $handle, $recursion, $group ) {
    385386                $group = (int) $group;
    386387
    387                 if ( $recursion ) {
    388                         $group = min( $this->group, $group );
    389                 }
    390 
    391                 $this->group = $group;
    392 
    393388                if ( isset($this->groups[$handle]) && $this->groups[$handle] <= $group )
    394389                        return false;
    395390
  • src/wp-includes/class.wp-scripts.php

    diff --git src/wp-includes/class.wp-scripts.php src/wp-includes/class.wp-scripts.php
    index 34f1016..9c04c27 100644
    class WP_Scripts extends WP_Dependencies { 
    356356         * @return bool True on success, false on failure.
    357357         */
    358358        public function all_deps( $handles, $recursion = false, $group = false ) {
    359                 $r = parent::all_deps( $handles, $recursion );
     359                $r = parent::all_deps( $handles, $recursion, $group );
    360360                if ( ! $recursion ) {
    361361                        /**
    362362                         * Filter the list of script dependencies left to print.
  • src/wp-includes/class.wp-styles.php

    diff --git src/wp-includes/class.wp-styles.php src/wp-includes/class.wp-styles.php
    index e9e38e3..01d45b5 100644
    class WP_Styles extends WP_Dependencies { 
    196196         * @return bool
    197197         */
    198198        public function all_deps( $handles, $recursion = false, $group = false ) {
    199                 $r = parent::all_deps( $handles, $recursion );
     199                $r = parent::all_deps( $handles, $recursion, $group );
    200200                if ( !$recursion ) {
    201201                        /**
    202202                         * Filter the array of enqueued styles before processing for output.