The disappearing public file path setting

Some problems that you stumble upon when building Drupl sites could be unique for that project, maybe some special mix with the modules that create errors that you do not get in another mix, this could be one of unique problems.

One of the Drupal 7 projects we are working on right now had some strange problems with the Public file system path. The file path did not work when we installed site (drush si profilename). If we after a site install tried to upload images to content, that did not work, and the path got screwed up (with null in it - this i believe comes from the Media module (fixed, see belov)) We are using a workflow where we do site installs a lot, to handle problems early in the project.

We had to go to the settings page (that showed the right file path), change the file path, save, change the path again to what we had before. Save. And it worked. But we do not want to do that every time, do we?

So we had to solve the problem, some how. I do not where the problems come from, and did not have the time to investigate further. But we solved it with setting the variable for the path in the from the setup_config function in the .profile file of the profile we use to install the site. So you could do it like this:

function profilename_setup_config() {
variable_set('file_public_path', 'sites/default/files/');
}

I just works. Not so much a hack, just configuration. But configuration that I think we should not need to configure ourselves. Anyhow. Problem solved. In this mix.

Comments

Ola Mæle Kleppa

What kind of function is _setup_config()? Can't find the API documentation.

mikke
Dave, yes that bug is fixed, but the fix did not solve the problem we had with the path. setup_config() is used in a profile .profile file.