Make WordPress Core

Changeset 16558


Ignore:
Timestamp:
11/24/2010 12:19:38 AM (16 years ago)
Author:
ryan
Message:

Load network plugins for wp-activate.php. Restore MU load order. Props blamenacin. fixes #14718

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/load.php

    r15968 r16558  
    473473        $active_plugins = (array) get_option( 'active_plugins', array() );
    474474
    475         // Get active network plugins
    476         if ( is_multisite() ) {
    477                 $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
    478                 if ( !empty($active_sitewide_plugins) ) {
    479                         $active_plugins = array_merge( $active_plugins, array_keys( $active_sitewide_plugins ) );
    480                         sort( $active_plugins );
    481                 }
    482         }
    483 
    484475        // Check for hacks file if the option is enabled
    485476        if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
    … …  
    491482                return $plugins;
    492483
     484        $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
     485
    493486        foreach ( $active_plugins as $plugin ) {
    494487                if ( ! validate_file( $plugin ) // $plugin must validate as file
    495488                        && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
    496489                        && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
     490                        // not already included as a network plugin
     491                        && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
    497492                        )
    498493                $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
  • trunk/wp-includes/ms-load.php

    r15551 r16558  
    2424
    2525        return false;
     26}
     27
     28/**
     29 * Returns array of network plugin files to be included in global scope.
     30 *
     31 * The default directory is wp-content/plugins. To change the default directory
     32 * manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code>
     33 * in wp-config.php.
     34 *
     35 * @access private
     36 * @since 3.1.0
     37 * @return array Files to include
     38 */
     39function wp_get_active_network_plugins() {
     40        $active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
     41        if ( empty( $active_plugins ) )
     42                return array();
     43
     44        $active_plugins = array_keys( $active_plugins );
     45        sort( $active_plugins );
     46
     47        foreach ( $active_plugins as $plugin ) {
     48                if ( ! validate_file( $plugin ) // $plugin must validate as file
     49                        && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
     50                        && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
     51                        )
     52                $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
     53        }
     54        return $plugins;
    2655}
    2756
  • trunk/wp-settings.php

    r16537 r16558  
    156156unset( $mu_plugin );
    157157
     158// Load network activated plugins.
     159if ( is_multisite() ) {
     160        foreach( wp_get_active_network_plugins() as $network_plugin ) {
     161                include_once( $network_plugin );
     162        }
     163        unset( $network_plugin );
     164}
     165
    158166do_action( 'muplugins_loaded' );
    159167
Note: See TracChangeset for help on using the changeset viewer.