WordPress.org

Make WordPress Core

Ticket #16953: 16953.no-single-file.diff

File 16953.no-single-file.diff, 923 bytes (added by rmccue, 6 years ago)

Ignore mu-plugins and single-file plugins

  • wp-includes/plugin.php

    diff --git wp-includes/plugin.php wp-includes/plugin.php
    index f5d213d..e880bc3 100644
    function wp_register_plugin_realpath( $file ) { 
    645645        $plugin_path = wp_normalize_path( dirname( $file ) );
    646646        $plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
    647647
     648        if ( $plugin_path === WP_PLUGIN_DIR || $plugin_path === WPMU_PLUGIN_DIR ) {
     649                return false;
     650        }
     651
    648652        if ( $plugin_path !== $plugin_realpath ) {
    649653                $wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
    650654        }
     655
     656        return true;
    651657}
    652658
    653659/**
  • wp-settings.php

    diff --git wp-settings.php wp-settings.php
    index aee35b3..9f73195 100644
    $GLOBALS['wp_plugin_paths'] = array(); 
    168168
    169169// Load must-use plugins.
    170170foreach ( wp_get_mu_plugins() as $mu_plugin ) {
    171         wp_register_plugin_realpath( $mu_plugin );
    172171        include_once( $mu_plugin );
    173172}
    174173unset( $mu_plugin );