WP eBooks
WordPress plugins, documentation and support for multisite networks
support area for everyone including pre-sale
I am trying to sharding BLOGUPLOADDIR but couldnt success atm. This is default one:
`define( ‘BLOGUPLOADDIR’, WP_CONTENT_DIR . “/blogs.dir/{$wpdb->blogid}/files/” );`
I am trying to set it:
`if($wpdb->blogidblogid/2000+1); // 1999->1, 2000->2 } define( ‘BLOGUPLOADDIR’, WP_CONTENT_DIR . “/blogs.dir/{$bloggroup}/{$wpdb->blogid}/files/” );`
So every 2000 blog, bloggroup will change.. I tried upload_dir filter but i need to define before it. I tried sunrise.php but $wpdb->blogid is not defined in there it seems. Whats propery way of this?
btw ` is not working for displaying code :-/ you can check from editing question
I have to fix the code embedding (via bbcode). The filter I was using in BP 1.2.X must have had a name change in 1.5.
If you are going to do it in sunrise then you need to have your own blog lookup in sunrise.php. sunrise.php how domain mapping bypasses the default blog lookup.
If you would be okay with 2048 per folder then you could do a simple calculation of
$bloggroup = ($wpdb->blogid >> 11) + 1;
i tried wp_upload_dir filter but it changes image url
http://example.com/files/2011/10/example.jpg
becomes different.. if i dont change $uploads['baseurl'] then images not displaying..
can you help if possible?
I removed that thought after. ms-files.php uses the constants to determine where the file is.
The site (network) lookup in WP is in ms-load.php & the blog lookup is in ms-settings.php. If you look at the sunrise.php in http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/ you’ll see the minimum variables you need tto set to bypass ythe WP lookup (so your install doesn’t do it twice).
there is too much place blogs.dir hardcoded.. like $dir = apply_filters( ‘wpmu_delete_blog_upload_dir’, WP_CONTENT_DIR . “/blogs.dir/{$blog_id}/files/”, $blog_id );
i checked http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/ but it creates $blog_id if blog is domain mapped :S
Right, so you need to write a sunrise.php that looks up the current site (network) & current blog and assigns the WP variable like domain mapping does. Then define your upload directory constants.
… i cant be alone on this problem.. how you guys handling 32.000+ blogs? there must be a proper known way :S
We don’t have 32K+ blogs in one install. However, the way everyone handles it is write a lookup in sunrise.php.
Remember Me
Subscribe to our newsletter to be the first to read about the latest releases.