• First of all thanks for this great plugin! I really like it.

    I was just wondering why the plugin doesn’t automatically set the cache dir for subsites in a multisite network. This is not just an inconvenience but also a security issue since one admin of a subsite can simply set any directory in the wp-content and override things in other sites.

    Maybe this could be done with a conditional. If multisite is enabled, prepend subsite path to the OMGF_CACHE_PATH. Or something like this.

    Or do you have any other reason in mind why it’s necessary to save fonts outside of this directory?

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    Hi @tobiasfeistmantl,

    Sorry for never getting back to you. It’s been a crazy few weeks/months.

    Thanks for your suggestion, though. How would I go about detecting what the subsite path would be? Btw, it shouldn’t be a URL, but a System Path.

    Thread Starter tobiasfeistmantl

    (@tobiasfeistmantl)

    Hi @daanvandenbergh,

    With a simple if statement. Something like this:

    $omgf_cache_dir = '/uploads/sites/omgf';
    
    if ( is_multisite() ) {
    	$omgf_cache_dir = '/uploads/sites/'. get_current_blog_id() . '/omgf';
    }
    
    define( 'OMGF_CACHE_PATH', esc_attr( get_option( OMGF_Admin_Settings::OMGF_BASIC_SETTING_CACHE_PATH ) ) ?: $omgf_cache_dir );

    I’m not sure if this is the right constant to modify but I think I get the point across.

    Tobias

    Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    Well, that looks way easier than I thought it’d be. Thanks a lot, I’ll add it to my todo list.

    Thread Starter tobiasfeistmantl

    (@tobiasfeistmantl)

    Just shoot me a message if you need two additional hands. 🙂

    Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    Well, since you’re offering 🙂

    Here’s OMGF’s repo on Github: https://github.com/dan0sz/host-webfonts-locally

    Feel free to fork it, add the feature, and create a pull request!

    Thread Starter tobiasfeistmantl

    (@tobiasfeistmantl)

    Hi Daan,

    I will have a look into it and see if I can assist you there. 🙂

    Plugin Author Daan van den Bergh

    (@daanvandenbergh)

    That’d be awesome. It’s on my todo list, but I’m in the middle of moving into a new house. So I can’t give an ETA ATM.

    Thread Starter tobiasfeistmantl

    (@tobiasfeistmantl)

    Hi Daan,

    how about removing the possibility on multisites for placing files outside the corresponding uploads directory at all? It’s in my opinion a security concern.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Why not set cache dir automatically in multisite?’ is closed to new replies.