WordPress.org

Make WordPress Core

Changeset 47048


Ignore:
Timestamp:
01/07/2020 03:26:44 PM (8 weeks ago)
Author:
gziolo
Message:

Build Tools: do not include assets for JS dependencies that do not exist.

This is a follow-up for #48154, where we started including *.asset.php files to declare package dependencies.
This works well but creates warnings in environments where the package does not exist because WordPress was not fully built.

Props jeherve, swissspidy.

Fixes #49144.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r47040 r47048  
    286286
    287287    foreach ( $packages as $package ) {
    288         $handle       = 'wp-' . $package;
    289         $path         = "/wp-includes/js/dist/$package$suffix.js";
    290         $asset_file   = include( ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php" );
     288        $handle = 'wp-' . $package;
     289        $path   = "/wp-includes/js/dist/$package$suffix.js";
     290
     291        if ( ! file_exists( ABSPATH . $path ) ) {
     292            continue;
     293        }
     294
     295        $asset_file   = include ABSPATH . WPINC . "/assets/dist/$package$suffix.asset.php";
    291296        $dependencies = $asset_file['dependencies'];
    292297
Note: See TracChangeset for help on using the changeset viewer.