<!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>[12848] trunk: Remove fix_actve_plugins().</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12848">12848</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-26 18:39:12 +0000 (Tue, 26 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove fix_actve_plugins(). Props hakre. fixes <a href="http://trac.wordpress.org/ticket/11750">#11750</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludespluginphp">trunk/wp-admin/includes/plugin.php</a></li>
<li><a href="#trunkwpadminplugineditorphp">trunk/wp-admin/plugin-editor.php</a></li>
<li><a href="#trunkwpadminpluginsphp">trunk/wp-admin/plugins.php</a></li>
<li><a href="#trunkwpincludesloadphp">trunk/wp-includes/load.php</a></li>
<li><a href="#trunkwpincludesmsdeprecatedphp">trunk/wp-includes/ms-deprecated.php</a></li>
<li><a href="#trunkwpincludesmsfunctionsphp">trunk/wp-includes/ms-functions.php</a></li>
<li><a href="#trunkwpincludesupdatephp">trunk/wp-includes/update.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 (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/plugin.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-admin/includes/plugin.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -258,8 +258,8 @@
</span><span class="cx">  * @param string $plugin Base plugin path from plugins directory.
</span><span class="cx">  * @return bool True, if in the active plugins list. False, not in the list.
</span><span class="cx">  */
</span><del>-function is_plugin_active($plugin) {
-        return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
</del><ins>+function is_plugin_active( $plugin ) {
+        return in_array( $plugin, apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) ) );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><span class="lines">@@ -286,9 +286,9 @@
</span><span class="cx">  * @param string $redirect Optional. URL to redirect to.
</span><span class="cx">  * @return WP_Error|null WP_Error on invalid file or null on success.
</span><span class="cx">  */
</span><del>-function activate_plugin($plugin, $redirect = '') {
-        $current = get_option('active_plugins');
-        $plugin = plugin_basename(trim($plugin));
</del><ins>+function activate_plugin( $plugin, $redirect = '' ) {
+        $current = get_option( 'active_plugins', array() );
+        $plugin  = plugin_basename( trim( $plugin ) );
</ins><span class="cx"> 
</span><span class="cx">         $valid = validate_plugin($plugin);
</span><span class="cx">         if ( is_wp_error($valid) )
</span><span class="lines">@@ -322,13 +322,10 @@
</span><span class="cx">  * @param string|array $plugins Single plugin or list of plugins to deactivate.
</span><span class="cx">  * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
</span><span class="cx">  */
</span><del>-function deactivate_plugins($plugins, $silent= false) {
-        $current = get_option('active_plugins');
</del><ins>+function deactivate_plugins( $plugins, $silent = false ) {
+        $current = get_option( 'active_plugins', array() );
</ins><span class="cx"> 
</span><del>-        if ( !is_array($plugins) )
-                $plugins = array($plugins);
-
-        foreach ( $plugins as $plugin ) {
</del><ins>+        foreach ( (array) $plugins as $plugin ) {
</ins><span class="cx">                 $plugin = plugin_basename($plugin);
</span><span class="cx">                 if ( ! is_plugin_active($plugin) )
</span><span class="cx">                         continue;
</span><span class="lines">@@ -475,26 +472,32 @@
</span><span class="cx">         return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * validate active plugins
+ * 
+ * validate all active plugins, deactivates invalid and 
+ * returns an array of deactived ones.
+ * 
+ * @since unknown
+ * @return array invalid plugins, plugin as key, error as value
+ */
</ins><span class="cx"> function validate_active_plugins() {
</span><del>-        $check_plugins = apply_filters( 'active_plugins', get_option('active_plugins') );
</del><ins>+        $plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
</ins><span class="cx"> 
</span><del>-        // Sanity check.  If the active plugin list is not an array, make it an
-        // empty array.
-        if ( !is_array($check_plugins) ) {
</del><ins>+        // validate vartype: array
+        if ( !is_array( $plugins ) ) {
</ins><span class="cx">                 update_option('active_plugins', array());
</span><span class="cx">                 return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        //Invalid is any plugin that is deactivated due to error.
</del><span class="cx">         $invalid = array();
</span><span class="cx"> 
</span><del>-        // If a plugin file does not exist, remove it from the list of active
-        // plugins.
-        foreach ( $check_plugins as $check_plugin ) {
-                $result = validate_plugin($check_plugin);
</del><ins>+        // invalid plugins get deactivated
+        foreach ( $plugins as $plugin ) {
+                $result = validate_plugin( $plugin );
</ins><span class="cx">                 if ( is_wp_error( $result ) ) {
</span><del>-                        $invalid[$check_plugin] = $result;
-                        deactivate_plugins( $check_plugin, true);
</del><ins>+                        $invalid[$plugin] = $result;
+                        deactivate_plugins( $plugin, true );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx">         return $invalid;
</span></span></pre></div>
<a id="trunkwpadminplugineditorphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugin-editor.php (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugin-editor.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-admin/plugin-editor.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -208,7 +208,7 @@
</span><span class="cx">                 &lt;div id=&quot;documentation&quot;&gt;&lt;label for=&quot;docs-list&quot;&gt;&lt;?php _e('Documentation:') ?&gt;&lt;/label&gt; &lt;?php echo $docs_select ?&gt; &lt;input type=&quot;button&quot; class=&quot;button&quot; value=&quot;&lt;?php esc_attr_e( 'Lookup' ) ?&gt; &quot; onclick=&quot;if ( '' != jQuery('#docs-list').val() ) { window.open( 'http://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;amp;locale=&lt;?php echo urlencode( get_locale() ) ?&gt;&amp;amp;version=&lt;?php echo urlencode( $wp_version ) ?&gt;&amp;amp;redirect=true'); }&quot; /&gt;&lt;/div&gt;
</span><span class="cx">                 &lt;?php endif; ?&gt;
</span><span class="cx"> &lt;?php if ( is_writeable($real_file) ) : ?&gt;
</span><del>-        &lt;?php if ( in_array($file, (array) get_option('active_plugins')) ) { ?&gt;
</del><ins>+        &lt;?php if ( in_array( $file, (array) get_option( 'active_plugins', array() ) ) ) { ?&gt;
</ins><span class="cx">                 &lt;p&gt;&lt;?php _e('&lt;strong&gt;Warning:&lt;/strong&gt; Making changes to active plugins is not recommended.  If your changes cause a fatal error, the plugin will be automatically deactivated.'); ?&gt;&lt;/p&gt;
</span><span class="cx">         &lt;?php } ?&gt;
</span><span class="cx">         &lt;p class=&quot;submit&quot;&gt;
</span></span></pre></div>
<a id="trunkwpadminpluginsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/plugins.php (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/plugins.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-admin/plugins.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx"> 
</span><span class="cx">                         require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
</span><span class="cx">                         require_once( 'admin-header.php' );
</span><del>-                        
</del><ins>+
</ins><span class="cx">                         $url = 'plugins.php?action=upgrade-selected&amp;amp;plugins=' . urlencode( join( ',', $plugins ) );
</span><span class="cx">                         $title = __( 'Upgrade Plugins' );
</span><span class="cx">                         $nonce = 'bulk-manage-plugins';
</span><span class="lines">@@ -283,9 +283,9 @@
</span><span class="cx"> 
</span><span class="cx"> if ( is_multisite() &amp;&amp; is_super_admin() ) {
</span><span class="cx">         $menu_perms = get_site_option('menu_items', array());
</span><del>-        if ( !$menu_perms['plugins'] ) {
</del><ins>+        if ( empty($menu_perms['plugins']) )
</ins><span class="cx">                 add_action( 'admin_notices', '_admin_notice_multisite_activate_plugins_page' );
</span><del>-        }
</del><ins>+        unset($menu_perms);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> $title = __('Manage Plugins');
</span></span></pre></div>
<a id="trunkwpincludesloadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/load.php (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/load.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-includes/load.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -404,7 +404,7 @@
</span><span class="cx">         if ( get_option( 'hack_file' ) &amp;&amp; file_exists( ABSPATH . 'my-hacks.php' ) )
</span><span class="cx">                         $plugins[] = ABSPATH . 'my-hacks.php';
</span><span class="cx"> 
</span><del>-        $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins' ) );
</del><ins>+        $active_plugins = apply_filters( 'active_plugins', get_option( 'active_plugins', array() ) );
</ins><span class="cx">         if ( !is_array( $active_plugins ) || defined( 'WP_INSTALLING' ) )
</span><span class="cx">                 return $plugins;
</span><span class="cx">         foreach ( $active_plugins as $plugin ) {
</span></span></pre></div>
<a id="trunkwpincludesmsdeprecatedphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-deprecated.php (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-deprecated.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-includes/ms-deprecated.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -110,4 +110,11 @@
</span><span class="cx">         return get_user_by('login', $username);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * @deprecated 3.0
+ */
+function clear_global_post_cache( $post_id ) {
+        _deprecated_function( __FUNCTION__, '3.0', 'clean_post_cache' );
+}
+
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesmsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-functions.php (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-functions.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-includes/ms-functions.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -725,11 +725,6 @@
</span><span class="cx">         return $post;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// deprecated, see clean_post_cache()
-function clear_global_post_cache( $post_id ) {
-        return;
-}
-
</del><span class="cx"> function add_user_to_blog( $blog_id, $user_id, $role ) {
</span><span class="cx">         switch_to_blog($blog_id);
</span><span class="cx"> 
</span><span class="lines">@@ -1986,13 +1981,6 @@
</span><span class="cx">         return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function fix_active_plugins( $value ) {
-        if ( false == is_array( $value ) )
-                $value = array();
-        return $value;
-}
-add_filter( &quot;option_active_plugins&quot;, &quot;fix_active_plugins&quot; );
-
</del><span class="cx"> if ( !function_exists('rss_gc') ) :
</span><span class="cx"> function rss_gc() {
</span><span class="cx">         global $wpdb;
</span></span></pre></div>
<a id="trunkwpincludesupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/update.php (12847 => 12848)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/update.php        2010-01-26 18:20:27 UTC (rev 12847)
+++ trunk/wp-includes/update.php        2010-01-26 18:39:12 UTC (rev 12848)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">                 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
</span><span class="cx"> 
</span><span class="cx">         $plugins = get_plugins();
</span><del>-        $active  = get_option( 'active_plugins' );
</del><ins>+        $active  = get_option( 'active_plugins', array() );
</ins><span class="cx">         $current = get_site_transient( 'update_plugins' );
</span><span class="cx">         if ( ! is_object($current) )
</span><span class="cx">                 $current = new stdClass;
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx">         $current-&gt;last_checked = time();
</span><span class="cx">         set_site_transient( 'update_plugins', $current );
</span><span class="cx"> 
</span><del>-        $to_send = (object)compact('plugins', 'active');
</del><ins>+        $to_send = (object) compact('plugins', 'active');
</ins><span class="cx"> 
</span><span class="cx">         $options = array(
</span><span class="cx">                 'timeout' =&gt; ( ( defined('DOING_CRON') &amp;&amp; DOING_CRON ) ? 30 : 3),
</span></span></pre>
</div>
</div>

</body>
</html>