Specify the "Private file system path" with tokens or programmatically (solved)

Events happening in the community are now at Drupal community events on www.drupal.org.
RobW's picture

I'm trying to set up a Feature to contain the basic config I set on pretty much every Drupal install.

One thing I'm running into trouble with is setting the "Private file system path" re-usably. I use sites/sitename.com instead of sites/default for my first site, and I need a way to either set the private path programmatically or with a token that returns the site folder. If I set the field manually and then pull out the var with Strongarm and Features, it's going to be specific to the site I build the feature on (sites/sitename.com/files/private). I could set it as sites/files/private or something and have every private file stored in the same directory if I set up a multisite, but that's a little hacky and would probably cause problems down the line. Any suggestions?

Comments

Private files are ideally

jeffschuler's picture

Private files are ideally stored outside your site directory, though I realize you'll still run into the same issue.

To further avoid your actual question, :) I generally use drush inside a shell script for initial setup of site vars:
drush vset --yes file_private_path /private/files/$site_dir_name

Thanks

RobW's picture

Right right, although there seems to be confusion whether "site directory" means your sites/sitename.com, or drupal install dir / webroot, but outside the webroot seems like the best idea. I don't have a huge problem relying on the .htacces for security, but you're right, better safe than sorry.

That drush script looks like what I need -- I was trying to take as much config and put it in features as possible, but it's probably a better idea to set the dir structure with something that only runs once. Do you know if you can use a relative path from the Drupal webroot, like ../private/$site_dir_name?

Gave it a shot, works

RobW's picture

Gave it a shot, works perfectly. Thanks.

Pittsburgh

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: