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

git-svn-id: https://develop.svn.wordpress.org/trunk@16558 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-11-24 00:19:38 +00:00
parent acbaa128c8
commit af8f9bf98d
3 changed files with 41 additions and 9 deletions

View File

@ -472,15 +472,6 @@ function wp_get_active_and_valid_plugins() {
$plugins = array();
$active_plugins = (array) get_option( 'active_plugins', array() );
// Get active network plugins
if ( is_multisite() ) {
$active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
if ( !empty($active_sitewide_plugins) ) {
$active_plugins = array_merge( $active_plugins, array_keys( $active_sitewide_plugins ) );
sort( $active_plugins );
}
}
// Check for hacks file if the option is enabled
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
_deprecated_file( 'my-hacks.php', '1.5' );
@ -490,10 +481,14 @@ function wp_get_active_and_valid_plugins() {
if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
return $plugins;
$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
foreach ( $active_plugins as $plugin ) {
if ( ! validate_file( $plugin ) // $plugin must validate as file
&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
// not already included as a network plugin
&& ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
)
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}

View File

@ -25,6 +25,35 @@ function is_subdomain_install() {
return false;
}
/**
* Returns array of network plugin files to be included in global scope.
*
* The default directory is wp-content/plugins. To change the default directory
* manually, define <code>WP_PLUGIN_DIR</code> and <code>WP_PLUGIN_URL</code>
* in wp-config.php.
*
* @access private
* @since 3.1.0
* @return array Files to include
*/
function wp_get_active_network_plugins() {
$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
if ( empty( $active_plugins ) )
return array();
$active_plugins = array_keys( $active_plugins );
sort( $active_plugins );
foreach ( $active_plugins as $plugin ) {
if ( ! validate_file( $plugin ) // $plugin must validate as file
&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
)
$plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
}
return $plugins;
}
/**
* Checks status of current blog.
*

View File

@ -155,6 +155,14 @@ foreach ( wp_get_mu_plugins() as $mu_plugin ) {
}
unset( $mu_plugin );
// Load network activated plugins.
if ( is_multisite() ) {
foreach( wp_get_active_network_plugins() as $network_plugin ) {
include_once( $network_plugin );
}
unset( $network_plugin );
}
do_action( 'muplugins_loaded' );
if ( is_multisite() )