Group Admins

  • Profile picture of andrea

general

Public Group active 1 week, 1 day ago

support area for everyone including pre-sale

Sharding BLOGUPLOADDIR (8 posts)

  • Profile picture of Ünsal Korkmaz Ünsal Korkmaz said 2 years, 11 months ago:

    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

  • Profile picture of ronr ronr said 2 years, 11 months ago:

    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;

  • Profile picture of Ünsal Korkmaz Ünsal Korkmaz said 2 years, 11 months ago:

    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?

  • Profile picture of ronr ronr said 2 years, 11 months ago:

    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).

  • Profile picture of Ünsal Korkmaz Ünsal Korkmaz said 2 years, 11 months ago:

    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

  • Profile picture of ronr ronr said 2 years, 11 months ago:

    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.

  • Profile picture of Ünsal Korkmaz Ünsal Korkmaz said 2 years, 11 months ago:


    i cant be alone on this problem..
    how you guys handling 32.000+ blogs? there must be a proper known way :S

  • Profile picture of ronr ronr said 2 years, 11 months ago:

    We don’t have 32K+ blogs in one install. However, the way everyone handles it is write a lookup in sunrise.php.