Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Load network plugins for wp-activate.php. Restore MU load order. Prop…

…s blamenacin. fixes #14718

git-svn-id: http://svn.automattic.com/wordpress/trunk@16558 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
commit 86c173262f8d4354006aa358e69d72b05e911be1 1 parent f4f5e8c
ryan authored
View
13 wp-includes/load.php
@@ -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
29 wp-includes/ms-load.php
@@ -26,6 +26,35 @@ function is_subdomain_install() {
}
/**
+ * 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 if the blog is deleted, inactive, archived, or spammed.
View
8 wp-settings.php
@@ -155,6 +155,14 @@
}
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() )
Please sign in to comment.
Something went wrong with that request. Please try again.