<!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>[13065] trunk:
  Improve the implementation of the default constant defining functions for multisite
 .</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13065">13065</a></dd>
<dt>Author</dt> <dd>westi</dd>
<dt>Date</dt> <dd>2010-02-12 08:22:34 +0000 (Fri, 12 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Improve the implementation of the default constant defining functions for multisite. See <a href="http://trac.wordpress.org/ticket/11881">#11881</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesmsdefaultconstantsphp">trunk/wp-includes/ms-default-constants.php</a></li>
<li><a href="#trunkwpincludesmsfilesphp">trunk/wp-includes/ms-files.php</a></li>
<li><a href="#trunkwpincludesmssettingsphp">trunk/wp-includes/ms-settings.php</a></li>
<li><a href="#trunkwpsettingsphp">trunk/wp-settings.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesmsdefaultconstantsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-default-constants.php (13064 => 13065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-default-constants.php        2010-02-12 07:59:11 UTC (rev 13064)
+++ trunk/wp-includes/ms-default-constants.php        2010-02-12 08:22:34 UTC (rev 13065)
</span><span class="lines">@@ -7,67 +7,82 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Defines Multisite default constants.
</del><ins>+ * Defines Multisite upload constants.
</ins><span class="cx">  *
</span><span class="cx">  * @since 3.0.0
</span><del>- * @param $context
</del><span class="cx">  */
</span><del>-function ms_default_constants( $context ) {
-        switch( $context ) {
-                case 'uploads' :
-                        global $wpdb;
-                        /** @since 3.0.0 */
-                        if ( !defined( 'UPLOADBLOGSDIR' ) )
-                                define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
-                        /** @since 3.0.0 */
-                        if ( !defined( 'UPLOADS' ) )
-                                define( 'UPLOADS', UPLOADBLOGSDIR . &quot;/{$wpdb-&gt;blogid}/files/&quot; );
-                        /** @since 3.0.0 */
-                        if ( !defined( 'BLOGUPLOADDIR' ) )
-                                define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . &quot;/blogs.dir/{$wpdb-&gt;blogid}/files/&quot; );
-                        break;
-                case 'cookies' :
-                        global $current_site;
-                        /**
-                         * @since 1.2.0
-                         */
-                        if ( !defined( 'COOKIEPATH' ) )
-                                        define( 'COOKIEPATH', $current_site-&gt;path );
-                        /**
-                         * @since 1.5.0
-                         */
-                        if ( !defined( 'SITECOOKIEPATH' ) )
-                                        define( 'SITECOOKIEPATH', $current_site-&gt;path );
-                        /**
-                         * @since 2.6.0
-                         */
-                        if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
-                                        if( !is_subdomain_install() ) {
-                                                        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
-                                        } else {
-                                                        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
-                                        }
-                        }
-                        /**
-                         * @since 2.0.0
-                         */
-                        if ( !defined('COOKIE_DOMAIN') )
-                                        define('COOKIE_DOMAIN', '.' . $current_site-&gt;cookie_domain);
-                        break;
-                case 'ms-files' :
-                        /**
-                         * Optional support for X-Sendfile header
-                         * @since 3.0.0
-                         */
-                        if ( !defined( 'WPMU_SENDFILE' ) )
-                                define( 'WPMU_SENDFILE', false );
-                        /**
-                         * Optional support for X-Accel-Redirect header
-                         * @since 3.0.0
-                         */
-                        if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
-                                define( 'WPMU_ACCEL_REDIRECT', false );
-                        break;
</del><ins>+function ms_upload_constants(  ) {
+        global $wpdb;
+
+        /** @since 3.0.0 */
+        if ( !defined( 'UPLOADBLOGSDIR' ) )
+                define( 'UPLOADBLOGSDIR', 'wp-content/blogs.dir' );
+
+        /** @since 3.0.0 */
+        if ( !defined( 'UPLOADS' ) )
+                define( 'UPLOADS', UPLOADBLOGSDIR . &quot;/{$wpdb-&gt;blogid}/files/&quot; );
+
+        /** @since 3.0.0 */
+        if ( !defined( 'BLOGUPLOADDIR' ) )
+                define( 'BLOGUPLOADDIR', WP_CONTENT_DIR . &quot;/blogs.dir/{$wpdb-&gt;blogid}/files/&quot; );
+}
+
+/**
+ * Defines Multisite cookie constants.
+ *
+ * @since 3.0.0
+ */
+function ms_cookie_constants(  ) {
+        global $current_site;
+        
+        /**
+         * @since 1.2.0
+         */
+        if ( !defined( 'COOKIEPATH' ) )
+                define( 'COOKIEPATH', $current_site-&gt;path );
+
+        /**
+         * @since 1.5.0
+         */
+        if ( !defined( 'SITECOOKIEPATH' ) )
+                define( 'SITECOOKIEPATH', $current_site-&gt;path );
+
+        /**
+         * @since 2.6.0
+         */
+        if ( !defined( 'ADMIN_COOKIE_PATH' ) ) {
+                if( !is_subdomain_install() ) {
+                        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH );
+                } else {
+                        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
+                }
</ins><span class="cx">         }
</span><ins>+
+        /**
+         * @since 2.0.0
+         */
+        if ( !defined('COOKIE_DOMAIN') )
+                define('COOKIE_DOMAIN', '.' . $current_site-&gt;cookie_domain);
</ins><span class="cx"> }
</span><ins>+
+/**
+ * Defines Multisite file constants.
+ *
+ * @since 3.0.0
+ */
+function ms_file_constants(  ) {
+        /**
+         * Optional support for X-Sendfile header
+         * @since 3.0.0
+         */
+        if ( !defined( 'WPMU_SENDFILE' ) )
+                define( 'WPMU_SENDFILE', false );
+
+        /**
+         * Optional support for X-Accel-Redirect header
+         * @since 3.0.0
+         */
+        if ( !defined( 'WPMU_ACCEL_REDIRECT' ) )
+                define( 'WPMU_ACCEL_REDIRECT', false );
+}
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesmsfilesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-files.php (13064 => 13065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-files.php        2010-02-12 07:59:11 UTC (rev 13064)
+++ trunk/wp-includes/ms-files.php        2010-02-12 08:22:34 UTC (rev 13065)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx">         require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ms_default_constants( 'ms-files' );
</del><ins>+ms_file_constants( );
</ins><span class="cx"> 
</span><span class="cx"> error_reporting( 0 );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkwpincludesmssettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/ms-settings.php (13064 => 13065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/ms-settings.php        2010-02-12 07:59:11 UTC (rev 13064)
+++ trunk/wp-includes/ms-settings.php        2010-02-12 08:22:34 UTC (rev 13065)
</span><span class="lines">@@ -124,6 +124,6 @@
</span><span class="cx"> wp_start_object_cache();
</span><span class="cx"> 
</span><span class="cx"> // Define upload directory constants
</span><del>-ms_default_constants( 'uploads' );
</del><ins>+ms_upload_constants(  );
</ins><span class="cx"> 
</span><span class="cx"> ?&gt;
</span></span></pre></div>
<a id="trunkwpsettingsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-settings.php (13064 => 13065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-settings.php        2010-02-12 07:59:11 UTC (rev 13064)
+++ trunk/wp-settings.php        2010-02-12 08:22:34 UTC (rev 13065)
</span><span class="lines">@@ -150,7 +150,8 @@
</span><span class="cx">                 die();
</span><span class="cx">         }
</span><span class="cx">         unset($file);
</span><del>-        ms_default_constants( 'cookies' );
</del><ins>+
+        ms_cookie_constants(  );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies().
</span></span></pre>
</div>
</div>

</body>
</html>