<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[16558] trunk: Load network plugins for wp-activate.php.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/16558">16558</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-11-24 00:19:38 +0000 (Wed, 24 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Load network plugins for wp-activate.php. Restore MU load order. Props blamenacin. fixes <a href="http://trac.wordpress.org/ticket/14718">#14718</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesloadphp">trunk/wp-includes/load.php</a></li>
<li><a href="#trunkwpincludesmsloadphp">trunk/wp-includes/ms-load.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesloadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/load.php (16557 => 16558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/load.php        2010-11-23 22:52:32 UTC (rev 16557)
+++ trunk/wp-includes/load.php        2010-11-24 00:19:38 UTC (rev 16558)
</span><span class="lines">@@ -472,15 +472,6 @@
</span><span class="cx">         $plugins = array();
</span><span class="cx">         $active_plugins = (array) get_option( 'active_plugins', array() );
</span><span class="cx">
</span><del>-        // 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 );
-                }
-        }
-
</del><span class="cx">         // Check for hacks file if the option is enabled
</span><span class="cx">         if ( get_option( 'hack_file' ) && file_exists( ABSPATH . 'my-hacks.php' ) ) {
</span><span class="cx">                 _deprecated_file( 'my-hacks.php', '1.5' );
</span><span class="lines">@@ -490,10 +481,14 @@
</span><span class="cx">         if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
</span><span class="cx">                 return $plugins;
</span><span class="cx">
</span><ins>+        $network_plugins = is_multisite() ? wp_get_active_network_plugins() : false;
+
</ins><span class="cx">         foreach ( $active_plugins as $plugin ) {
</span><span class="cx">                 if ( ! validate_file( $plugin ) // $plugin must validate as file
</span><span class="cx">                         && '.php' == substr( $plugin, -4 ) // $plugin must end with '.php'
</span><span class="cx">                         && file_exists( WP_PLUGIN_DIR . '/' . $plugin ) // $plugin must exist
</span><ins>+                        // not already included as a network plugin
+                        && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin, $network_plugins ) )
</ins><span class="cx">                         )
</span><span class="cx">                 $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkwpincludesmsloadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-load.php (16557 => 16558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-load.php        2010-11-23 22:52:32 UTC (rev 16557)
+++ trunk/wp-includes/ms-load.php        2010-11-24 00:19:38 UTC (rev 16558)
</span><span class="lines">@@ -26,6 +26,35 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * 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;
+}
+
+/**
</ins><span class="cx"> * Checks status of current blog.
</span><span class="cx"> *
</span><span class="cx"> * Checks if the blog is deleted, inactive, archived, or spammed.
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (16557 => 16558)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-11-23 22:52:32 UTC (rev 16557)
+++ trunk/wp-settings.php        2010-11-24 00:19:38 UTC (rev 16558)
</span><span class="lines">@@ -155,6 +155,14 @@
</span><span class="cx"> }
</span><span class="cx"> unset( $mu_plugin );
</span><span class="cx">
</span><ins>+// Load network activated plugins.
+if ( is_multisite() ) {
+        foreach( wp_get_active_network_plugins() as $network_plugin ) {
+                include_once( $network_plugin );
+        }
+        unset( $network_plugin );
+}
+
</ins><span class="cx"> do_action( 'muplugins_loaded' );
</span><span class="cx">
</span><span class="cx"> if ( is_multisite() )
</span></span></pre>
</div>
</div>
</body>
</html>