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

git-svn-id: http://svn.automattic.com/wordpress/trunk@16558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-11-24 00:19:38 +00:00
parent f4f5e8caa8
commit 86c173262f
3 changed files with 41 additions and 9 deletions

View File

@ -472,15 +472,6 @@ function wp_get_active_and_valid_plugins() {
$plugins = array(); $plugins = array();
$active_plugins = (array) get_option( 'active_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 // Check for hacks file if the option is enabled
if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) { if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
_deprecated_file( 'my-hacks.php', '1.5' ); _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' ) ) if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
return $plugins; return $plugins;
$network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
foreach ( $active_plugins as $plugin ) { foreach ( $active_plugins as $plugin ) {
if ( ! validate_file( $plugin ) // $plugin must validate as file if ( ! validate_file( $plugin ) // $plugin must validate as file
&& '.php' == substr( $plugin, -4 ) // $plugin must end with '.php' && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
&& file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist && 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; $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
} }

View File

@ -25,6 +25,35 @@ function is_subdomain_install() {
return false; 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. * Checks status of current blog.
* *

View File

@ -155,6 +155,14 @@ foreach ( wp_get_mu_plugins() as $mu_plugin ) {
} }
unset( $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' ); do_action( 'muplugins_loaded' );
if ( is_multisite() ) if ( is_multisite() )