<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>WPMU DEV Community &#187; Topic: tiering media for multisite</title>
		<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite</link>
		<description>WPMU DEV Community &#187; Topic: tiering media for multisite</description>
		<language>en-US</language>
		<pubDate>Sun, 26 May 2013 07:10:07 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.2</generator>
		<atom:link href="http://premium.wpmudev.org/forums/rss/topic/tiering-media-for-multisite" rel="self" type="application/rss+xml" />

		<item>
			<title>Mark de Scande on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-232467</link>
			<pubDate>Wed, 13 Jun 2012 21:07:07 +0000</pubDate>
			<dc:creator>Mark de Scande</dc:creator>
			<guid isPermaLink="false">232467@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Also working on BlogLines.co.za THANK YOU @Mustafa
</p>]]></description>
		</item>
		<item>
			<title>Mustafa on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-130212</link>
			<pubDate>Thu, 08 Sep 2011 16:26:04 +0000</pubDate>
			<dc:creator>Mustafa</dc:creator>
			<guid isPermaLink="false">130212@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>This is my technique.<br />
I've tested and using now.I can't see any problem :)
</p>]]></description>
		</item>
		<item>
			<title>Shawn on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-130102</link>
			<pubDate>Thu, 08 Sep 2011 10:05:55 +0000</pubDate>
			<dc:creator>Shawn</dc:creator>
			<guid isPermaLink="false">130102@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Thanks guys. I appreciate the time you've taken to assist me with this. I had to take a few days off to address this stupid <a href="http://premium.wpmudev.org/forums/topic/timthumb-script">TimThumb thing</a>. Sigh.</p>
<p>Anyway...</p>
<p>I've tested a half dozen different mechanisms for this now, and the only implementation-consistent one I can find is to edit the core in the ms_upload_constants() function... but then I have to worry about yet another file to edit during every single upgrade, and while that may work whether I'm using Multi-DB or not, it's too unscalable and unreliable to take too seriously. <a href="http://core.trac.wordpress.org/ticket/18464">I *hate* editing core files!</a></p>
<p><a href="http://core.trac.wordpress.org/ticket/18489">There's a ticket</a> that is attempting to address this problem which I've been participating in for the last week or so, but I'm getting the impression my request is a lost cause. :(</p>
<p>Assigning the constants within the Multi-DB configuration works, and that looks like it's the way to go for this specific client. In fact, it's the ONLY place between database creation/mapping and the constant assignment to effect these based on the blog id. So, the bottom line is, I just have to make sure that each site that I need to be able to scale for file storage is also using Multi-DB. That's fine with me. :)
</p>]]></description>
		</item>
		<item>
			<title>DavidM on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-127299</link>
			<pubDate>Mon, 29 Aug 2011 17:02:34 +0000</pubDate>
			<dc:creator>DavidM</dc:creator>
			<guid isPermaLink="false">127299@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Good stuff here, guys! Not something I've come across, I'll mention this to a few others over here in case they have anything to add.</p>
<p>Cheers,<br />
David
</p>]]></description>
		</item>
		<item>
			<title>Mustafa on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-127087</link>
			<pubDate>Sun, 28 Aug 2011 12:16:12 +0000</pubDate>
			<dc:creator>Mustafa</dc:creator>
			<guid isPermaLink="false">127087@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>I forgot to add link.<br />
Also you can read <a href="http://premium.wpmudev.org/forums/topic/32000-file-limit-linux">this topic</a>.</p>
<p>Cheers,
</p>]]></description>
		</item>
		<item>
			<title>Mustafa on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-127078</link>
			<pubDate>Sun, 28 Aug 2011 10:17:37 +0000</pubDate>
			<dc:creator>Mustafa</dc:creator>
			<guid isPermaLink="false">127078@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Hiya Shawn,</p>
<p>I know solution :)<br />
Not define in wp-config.php</p>
<p>wp-includes/ms-default-constants.php<br />
Function ms_upload_constants</p>
<p>for example you can use this,<br />
<pre><code>function ms_upload_constants(  ) {
	global $wpdb;
/* change upload procedure.This procedure developed by Mustafa Uysal, for high scalability*/

	if ( !defined( &#39;UPLOADBLOGSDIR&#39; ) )
		define( &#39;UPLOADBLOGSDIR&#39;, &#39;wp-content/blogs.dir&#39; );

	if( $wpdb-&#62;blogid &#60;40000) {
	 //first don&#39;t change default upload pacth
		define( &#39;UPLOADS&#39;, UPLOADBLOGSDIR . &#34;/{$wpdb-&#62;blogid}/files/&#34; );
		if ( &#39;wp-content/blogs.dir&#39; == UPLOADBLOGSDIR )
			define( &#39;BLOGUPLOADDIR&#39;, WP_CONTENT_DIR . &#34;/blogs.dir/{$wpdb-&#62;blogid}/files/&#34; );
	}
	else if ( ($wpdb-&#62;blogid &#62; 40000) &#38;&#38; ($wpdb-&#62;blogid &#60; 72000) ) {
 //change path for new uploads
		define( &#39;UPLOADS&#39;, UPLOADBLOGSDIR . &#34;/space2/{$wpdb-&#62;blogid}/files/&#34; );
		if ( &#39;wp-content/blogs.dir&#39; == UPLOADBLOGSDIR )
			define( &#39;BLOGUPLOADDIR&#39;, WP_CONTENT_DIR . &#34;/blogs.dir/space2/{$wpdb-&#62;blogid}/files/&#34; );
	}
}
.
.
.</code></pre>
<p>Also you can mount this spaces for nfs.</p>
<p>I hope this helpful<br />
Cheers
</p>]]></description>
		</item>
		<item>
			<title>Chris on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-127073</link>
			<pubDate>Sun, 28 Aug 2011 09:39:50 +0000</pubDate>
			<dc:creator>Chris</dc:creator>
			<guid isPermaLink="false">127073@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Part of the issue here is a site that is already hosting 40,000 blogs not wanting to spend money hehe.</p>
<p>Be intrigued to see what solution you find.
</p>]]></description>
		</item>
		<item>
			<title>Shawn on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-127067</link>
			<pubDate>Sun, 28 Aug 2011 06:24:57 +0000</pubDate>
			<dc:creator>Shawn</dc:creator>
			<guid isPermaLink="false">127067@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Thanks, Mustafa, but that won't actually work.</p>
<p>The biggest problem is that in context, "$wpdb-&#62;blogid" simply isn't available at this point. Neither is $blog_id. This information isn't available until after the constant is defined at it's default value, which is too late to reset it. :(</p>
<p>This site has over 40k blogs. Those created in the last couple months didn't have their new "blogs.dir" structures created due to the 32k link limit, and they only recently brought me into the situation to research it. Yes, this means that thousands of our users are already suffering from limited usability due to this issue.</p>
<p>The client is trying to cut costs as much as possible, so replacing this server isn't currently an option, and the current OS doesn't support ext4. Even if we were to switch to ext4, at this rate it'd be only a few months before it became insufficient for our needs.</p>
<p>NFS is an idea I've considered in the past, but it doesn't actually address the problem...which is the processing order within WP core.</p>
<p>I had an idea a little while ago, though. I already use Multi-DB, and may be able to use it as the hook into the data I require before the constant is declared. Hopefully this will work. I'll post the results of my research here.
</p>]]></description>
		</item>
		<item>
			<title>Mustafa on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-126992</link>
			<pubDate>Sat, 27 Aug 2011 15:57:20 +0000</pubDate>
			<dc:creator>Mustafa</dc:creator>
			<guid isPermaLink="false">126992@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>Hiya Shawn,</p>
<p>Yup,this times<br />
 I'm working for storage procedure for high scalability.</p>
<p>If you change current path your media files not seem for current blogs.<br />
How many blog have you got ?</p>
<p>My opinion follow this way:<br />
Install nfs mount,<br />
then mount directory blogsdir.</p>
<p>After then define upload paths with blog id.<br />
For example:<br />
<pre><code>if($wpdb-&#62;blogid &#62;32000 &#38;&#38; $wpdb-&#62;blogid &#60; 64000)
{
define(&#39;UPLOADBLOGSDIR&#39;,&#39;storage/sector2&#39;)
bla
bla
bla
.
.
.
}</code></pre>
<p>Also you can try to upgrade filesystem ext4 support 64k folder?Am I right?</p>
<p>Cheers.
</p>]]></description>
		</item>
		<item>
			<title>Shawn on "tiering media for multisite"</title>
			<link>http://premium.wpmudev.org/forums/topic/tiering-media-for-multisite#post-126971</link>
			<pubDate>Sat, 27 Aug 2011 13:38:22 +0000</pubDate>
			<dc:creator>Shawn</dc:creator>
			<guid isPermaLink="false">126971@http://premium.wpmudev.org/forums/</guid>
			<description><![CDATA[<p>A few months ago one of my client sites hit the 32k link limit on an ext3 filesystem. Upgrading and moving the media elsewhere are not valid options. I'd also like to AVOID modifying core if possible. That's where the problem is.</p>
<p>What I'd like to be able to do is simply MOVE the media to a tiered structure to prevent this from happening again. In other words, change this:<br />
<pre><code>wp-content/blogs.dir/1234/
wp-content/blogs.dir/33669/
wp-content/blogs.dir/48484/</code></pre>
<p>To this:<br />
<pre><code>wp-content/blogs.dir/12/1234/
wp-content/blogs.dir/33/33669/
wp-content/blogs.dir/48/48484/</code></pre>
<p>Hooking into get_option for upload_path is simple enough, and works fine as far as uploading. But it doesn't address actually viewing the media. ms-files.php is setup to minimize it's load by using a short init, which means plugins and hooks simply aren't called, and I can't see anywhere within the entire WP engine loading process that I can inject a *dynamic* parsing routine for this specific pattern.</p>
<p>I can define a constant (BLOGUPLOADDIR) within wp-config...but in order for this to work the constant has to be able to determine the blog_id, which isn't known during the wp-config or wp-settings stages, and between there and the default ms constant declarations there simply aren't any hooks to effect modification of the values for assignment, and where it passes the value to the actual media, it tests only the constant and filename, which no means of ensuring it meets my pattern.</p>
<p>So...does anyone have any ideas to make this (or something similar) work?</p>
<p>I'm thinking what I'll probably need to do is parse instead for the base URL (subdomain or subdirectory) and use a hash of that instead of the blog_id. The problem with that? It's going to seriously cause issues with back-end media management and frankly, just moving it over to the new directory structure.
</p>]]></description>
		</item>

	</channel>
</rss>