<!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>[12947] trunk: Sitewide plugins cleanup.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12947">12947</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-02-04 18:50:36 +0000 (Thu, 04 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Sitewide plugins cleanup. Props nacin. see <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludespluginphp">trunk/wp-admin/includes/plugin.php</a></li>
<li><a href="#trunkwpadminincludesupgradephp">trunk/wp-admin/includes/upgrade.php</a></li>
<li><a href="#trunkwpincludesloadphp">trunk/wp-includes/load.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludespluginphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/plugin.php (12946 => 12947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin.php        2010-02-04 18:46:25 UTC (rev 12946)
+++ trunk/wp-admin/includes/plugin.php        2010-02-04 18:50:36 UTC (rev 12947)
</span><span class="lines">@@ -259,7 +259,7 @@
</span><span class="cx">  * @return bool True, if in the active plugins list. False, not in the list.
</span><span class="cx">  */
</span><span class="cx"> function is_plugin_active( $plugin ) {
</span><del>-        return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) );
</del><ins>+        return in_array( $plugin, (array) get_option( 'active_plugins', array() ) ) || is_plugin_active_for_network( $plugin );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -270,7 +270,7 @@
</span><span class="cx">  * @param string $plugin Base plugin path from plugins directory.
</span><span class="cx">  * @return bool True, if active for the network, otherwise false.
</span><span class="cx">  */
</span><del>-function is_plugin_active_for_network( $plugin ){
</del><ins>+function is_plugin_active_for_network( $plugin ) {
</ins><span class="cx">         if ( !is_multisite() )
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><span class="lines">@@ -553,7 +553,7 @@
</span><span class="cx">  * @return array invalid plugins, plugin as key, error as value
</span><span class="cx">  */
</span><span class="cx"> function validate_active_plugins() {
</span><del>-        $plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
</del><ins>+        $plugins = get_option( 'active_plugins', array() );
</ins><span class="cx">         // validate vartype: array
</span><span class="cx">         if ( ! is_array( $plugins ) ) {
</span><span class="cx">                 update_option( 'active_plugins', array() );
</span><span class="lines">@@ -562,7 +562,7 @@
</span><span class="cx"> 
</span><span class="cx">         if ( is_multisite() &amp;&amp; is_super_admin() ) {
</span><span class="cx">                 $network_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
</span><del>-                $plugins = array_merge( (array) $plugins, $network_plugins );
</del><ins>+                $plugins = array_merge( $plugins, $network_plugins );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if ( empty( $plugins ) )
</span></span></pre></div>
<a id="trunkwpadminincludesupgradephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/upgrade.php (12946 => 12947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/upgrade.php        2010-02-04 18:46:25 UTC (rev 12946)
+++ trunk/wp-admin/includes/upgrade.php        2010-02-04 18:50:36 UTC (rev 12947)
</span><span class="lines">@@ -1098,6 +1098,7 @@
</span><span class="cx">  * @since 3.0.0
</span><span class="cx">  */
</span><span class="cx"> function upgrade_network() {
</span><ins>+        global $wp_current_db_version;
</ins><span class="cx">         // 2.8
</span><span class="cx">         if ( $wp_current_db_version &lt; 11549 ) {
</span><span class="cx">                 $wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
</span><span class="lines">@@ -1110,8 +1111,8 @@
</span><span class="cx"> 
</span><span class="cx">                         update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
</span><span class="cx">                 }
</span><del>-                update_site_option( 'wpmu_sitewide_plugins', '' );
-                update_site_option( 'deactivated_sitewide_plugins', '' );
</del><ins>+                delete_site_option( 'wpmu_sitewide_plugins' );
+                delete_site_option( 'deactivated_sitewide_plugins' );
</ins><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesloadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/load.php (12946 => 12947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/load.php        2010-02-04 18:46:25 UTC (rev 12946)
+++ trunk/wp-includes/load.php        2010-02-04 18:50:36 UTC (rev 12947)
</span><span class="lines">@@ -403,13 +403,8 @@
</span><span class="cx">  */
</span><span class="cx"> function wp_load_plugins() {
</span><span class="cx">         $plugins = array();
</span><ins>+        $active_plugins = (array) get_option( 'active_plugins', array() );
</ins><span class="cx"> 
</span><del>-        // Check for hacks file if the option is enabled
-        if ( get_option( 'hack_file' ) &amp;&amp; file_exists( ABSPATH . 'my-hacks.php' ) )
-                        $plugins[] = ABSPATH . 'my-hacks.php';
-
-        $active_plugins = (array) apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
-
</del><span class="cx">         // Get active network plugins
</span><span class="cx">         if ( is_multisite() ) {
</span><span class="cx">                 $active_sitewide_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
</span><span class="lines">@@ -419,6 +414,12 @@
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        // Check for hacks file if the option is enabled
+        if ( get_option( 'hack_file' ) &amp;&amp; file_exists( ABSPATH . 'my-hacks.php' ) ) {
+                _deprecated_file( 'my-hacks.php', '1.5' );
+                array_unshift( $plugins, ABSPATH . 'my-hacks.php' );
+        }
+
</ins><span class="cx">         if ( empty( $active_plugins ) || defined( 'WP_INSTALLING' ) )
</span><span class="cx">                 return $plugins;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>