<!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>[12726] trunk/wp-admin/includes: merge multisite wp-admin/
 includes except schema, See #11644</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12726">12726</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-01-15 00:21:13 +0000 (Fri, 15 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>merge multisite wp-admin/includes except schema, See <a href="http://trac.wordpress.org/ticket/11644">#11644</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesmiscphp">trunk/wp-admin/includes/misc.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminincludesupdatephp">trunk/wp-admin/includes/update.php</a></li>
<li><a href="#trunkwpadminincludesuserphp">trunk/wp-admin/includes/user.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesmiscphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/misc.php (12725 => 12726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/misc.php        2010-01-14 19:42:55 UTC (rev 12725)
+++ trunk/wp-admin/includes/misc.php        2010-01-15 00:21:13 UTC (rev 12726)
</span><span class="lines">@@ -120,6 +120,9 @@
</span><span class="cx">  * @since unknown
</span><span class="cx">  */
</span><span class="cx"> function save_mod_rewrite_rules() {
</span><ins>+        if ( is_multisite() )
+                return;
+
</ins><span class="cx">         global $wp_rewrite;
</span><span class="cx"> 
</span><span class="cx">         $home_path = get_home_path();
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12725 => 12726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-14 19:42:55 UTC (rev 12725)
+++ trunk/wp-admin/includes/template.php        2010-01-15 00:21:13 UTC (rev 12726)
</span><span class="lines">@@ -229,11 +229,12 @@
</span><span class="cx">                                 &lt;span class=&quot;title&quot;&gt;&lt;?php _e( 'Name' ); ?&gt;&lt;/span&gt;
</span><span class="cx">                                 &lt;span class=&quot;input-text-wrap&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;name&quot; class=&quot;ptitle&quot; value=&quot;&quot; /&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/label&gt;
</span><del>-
</del><ins>+&lt;?php if ( !is_multisite() ) { ?&gt;
</ins><span class="cx">                         &lt;label&gt;
</span><span class="cx">                                 &lt;span class=&quot;title&quot;&gt;&lt;?php _e( 'Slug' ); ?&gt;&lt;/span&gt;
</span><span class="cx">                                 &lt;span class=&quot;input-text-wrap&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;slug&quot; class=&quot;ptitle&quot; value=&quot;&quot; /&gt;&lt;/span&gt;
</span><span class="cx">                         &lt;/label&gt;
</span><ins>+&lt;?php } ?&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;?php if ( 'category' == $type ) : ?&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludesupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/update.php (12725 => 12726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/update.php        2010-01-14 19:42:55 UTC (rev 12725)
+++ trunk/wp-admin/includes/update.php        2010-01-15 00:21:13 UTC (rev 12726)
</span><span class="lines">@@ -82,6 +82,9 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function core_update_footer( $msg = '' ) {
</span><ins>+        if( is_multisite() &amp;&amp; !is_super_admin() )
+                return false;
+
</ins><span class="cx">         if ( !current_user_can('manage_options') )
</span><span class="cx">                 return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
</span><span class="cx"> 
</span><span class="lines">@@ -115,6 +118,9 @@
</span><span class="cx"> add_filter( 'update_footer', 'core_update_footer' );
</span><span class="cx"> 
</span><span class="cx"> function update_nag() {
</span><ins>+        if( is_multisite() &amp;&amp; !is_super_admin() )
+                return false;
+
</ins><span class="cx">         global $pagenow;
</span><span class="cx"> 
</span><span class="cx">         if ( 'update-core.php' == $pagenow )
</span><span class="lines">@@ -136,6 +142,9 @@
</span><span class="cx"> 
</span><span class="cx"> // Called directly from dashboard
</span><span class="cx"> function update_right_now_message() {
</span><ins>+        if( is_multisite() &amp;&amp; !is_super_admin() )
+                return false;
+
</ins><span class="cx">         $cur = get_preferred_from_update_core();
</span><span class="cx"> 
</span><span class="cx">         $msg = sprintf( __('You are using &lt;span class=&quot;b&quot;&gt;WordPress %s&lt;/span&gt;.'), $GLOBALS['wp_version'] );
</span><span class="lines">@@ -196,7 +205,10 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function wp_update_plugin($plugin, $feedback = '') {
</span><ins>+        if( is_multisite() &amp;&amp; !is_super_admin() )
+                return false;
</ins><span class="cx"> 
</span><ins>+
</ins><span class="cx">         if ( !empty($feedback) )
</span><span class="cx">                 add_filter('update_feedback', $feedback);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpadminincludesuserphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/user.php (12725 => 12726)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/user.php        2010-01-14 19:42:55 UTC (rev 12725)
+++ trunk/wp-admin/includes/user.php        2010-01-15 00:21:13 UTC (rev 12726)
</span><span class="lines">@@ -197,7 +197,11 @@
</span><span class="cx">  */
</span><span class="cx"> function get_author_user_ids() {
</span><span class="cx">         global $wpdb;
</span><del>-        $level_key = $wpdb-&gt;prefix . 'user_level';
</del><ins>+        if( !is_multisite() ) {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'user_level';
+        } else {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+        }
</ins><span class="cx">         return $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = %s AND meta_value != '0'&quot;, $level_key) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -248,9 +252,12 @@
</span><span class="cx">                 else
</span><span class="cx">                         return array();
</span><span class="cx">         }
</span><ins>+        if( !is_multisite() ) {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'user_level';
+        } else {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+        }
</ins><span class="cx"> 
</span><del>-        $level_key = $wpdb-&gt;prefix . 'user_level';
-
</del><span class="cx">         $query = $wpdb-&gt;prepare(&quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = %s&quot;, $level_key);
</span><span class="cx">         if ( $exclude_zeros )
</span><span class="cx">                 $query .= &quot; AND meta_value != '0'&quot;;
</span><span class="lines">@@ -294,8 +301,13 @@
</span><span class="cx">  */
</span><span class="cx"> function get_nonauthor_user_ids() {
</span><span class="cx">         global $wpdb;
</span><del>-        $level_key = $wpdb-&gt;prefix . 'user_level';
</del><span class="cx"> 
</span><ins>+        if ( !is_multisite() ) {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'user_level';
+        } else {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+        }
+
</ins><span class="cx">         return $wpdb-&gt;get_col( $wpdb-&gt;prepare(&quot;SELECT user_id FROM $wpdb-&gt;usermeta WHERE meta_key = %s AND meta_value = '0'&quot;, $level_key) );
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -440,10 +452,14 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         // FINALLY, delete user
</span><ins>+        if ( !is_multisite() ) {
+                $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id = %d&quot;, $id) );
+                $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;users WHERE ID = %d&quot;, $id) );
+        } else {
+                $level_key = $wpdb-&gt;get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+                $wpdb-&gt;query(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id = $id AND meta_key = '{$level_key}'&quot;);
+        }
</ins><span class="cx"> 
</span><del>-        $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;usermeta WHERE user_id = %d&quot;, $id) );
-        $wpdb-&gt;query( $wpdb-&gt;prepare(&quot;DELETE FROM $wpdb-&gt;users WHERE ID = %d&quot;, $id) );
-
</del><span class="cx">         wp_cache_delete($id, 'users');
</span><span class="cx">         wp_cache_delete($user-&gt;user_login, 'userlogins');
</span><span class="cx">         wp_cache_delete($user-&gt;user_email, 'useremail');
</span><span class="lines">@@ -661,8 +677,12 @@
</span><span class="cx">                 $this-&gt;query_from_where = &quot;FROM $wpdb-&gt;users&quot;;
</span><span class="cx">                 if ( $this-&gt;role )
</span><span class="cx">                         $this-&gt;query_from_where .= $wpdb-&gt;prepare(&quot; INNER JOIN $wpdb-&gt;usermeta ON $wpdb-&gt;users.ID = $wpdb-&gt;usermeta.user_id WHERE $wpdb-&gt;usermeta.meta_key = '{$wpdb-&gt;prefix}capabilities' AND $wpdb-&gt;usermeta.meta_value LIKE %s&quot;, '%' . $this-&gt;role . '%');
</span><del>-                else
</del><ins>+                elseif ( !is_multisite() )
</ins><span class="cx">                         $this-&gt;query_from_where .= &quot; WHERE 1=1&quot;;
</span><ins>+                else {
+                        $level_key = $wpdb-&gt;get_blog_prefix() . 'capabilities'; // wpmu site admins don't have user_levels
+                        $this-&gt;query_from_where .= &quot;, $wpdb-&gt;usermeta WHERE $wpdb-&gt;users.ID = $wpdb-&gt;usermeta.user_id AND meta_key = '{$level_key}'&quot;;
+                }
</ins><span class="cx">                 $this-&gt;query_from_where .= &quot; $search_sql&quot;;
</span><span class="cx"> 
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>