[wp-trac] [WordPress Trac] #19030: Sharding BLOGUPLOADDIR

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 24 01:21:37 UTC 2011


#19030: Sharding BLOGUPLOADDIR
--------------------------+-----------------------------
 Reporter:  unsalkorkmaz  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Multisite     |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 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->blogid<10){
     $bloggroup = 'global';
 }else{
     $bloggroup = 'bloggroup'.floor($wpdb->blogid/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 proper way of this?

 btw i think this need change:

 {{{
 $dir = apply_filters( 'wpmu_delete_blog_upload_dir', WP_CONTENT_DIR .
 "/blogs.dir/{$blog_id}/files/", $blog_id );
 }}}

 it wont delete uploads if i define BLOGUPLOADDIR right?

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19030>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list