Provide an option, during Drupal Commons installation, to set the location/name of the "Files" directory before Commons begins generating content/files.

I frequently use multi-site configurations to develop a new version of a website. During development the site will be located at something like subdomain.mydomain.net. Without this option, when the site is moved to production, either on the same installation of Drupal, or another installation/hosting account, the /sites/subdomain.mydomain.net directory will be renamed appropriately to something like /sites/client-domain.com. After the renaming, any references to files contained in the database will incorrectly point to /sites/subdomain.mydomain.net/files. If the files directory location could be specified during installation to a designated directory, e.g., /files-loc1, then this problem would not exist.

I don't see any problem presenting the installer with the option to specify the files location with the default directory being /sites/sitename/files, or something similar,as it is now. I just want to be able to change it before files start being created.

Mel

Comments

mstef’s picture

This sounds more like a Drupal Core feature request, no?

Mel55113’s picture

Mike,

I don't think this is a core issue; here's why: If I'm using the standard profile, then no content is created before I get the (manual) option to go in and change the files directory name and location. IIRC, if you look at a DC site's files directory immediately after creation you'll see several directories, including images (IIRC) that have already been created. I think that it's highly likely that the path to the files directory, /sites/site.name/files, is already in content in the database. Therefore, I can't simply copy the files directory structure to another location and change the site configuration because doing so would "break" that existing content.

Mel

mstef’s picture

The Drupal installer checks to make sure you have a writable files directory before installing, though.

I understand your concern about the files directory being stored in places inside the database. I don't think that's an issue though. There are hooks in place to update the files directory path for any CCK imagefields that use a default image. The user profile default images are stored only with the name of the file, not the path.

Try moving the files directory, updating the path setting in Drupal, then clearing the cache, and see if any issues arise.

Mel55113’s picture

I copies the files directory to my preferred location, renamed /sites/.../files so that it couldn't be accessed by the original name, and cleared caches.

The results:

  • Group images broke. Nothing showed up but there was an option to remove the non-existent file (it would be nice if the file name was displayed). I had to re-upload the images (it would be nice to be able to browse the server, ala IMCE).
  • User pictures broke just like group images.
  • As could be expected, images inserted in content via IMCE had to be "re-pointed."
  • Again, as could be expected, the logo and favicon images had to be set to the new file location.

The process wouldn't have been too bad if I had made the changes before starting to configure, setup, and populate the site. However, this installation was an upgrade from a DC 1.5 site I had in early stages of development.

Even though I could work around the issues, I still believe it would be a good configuration option for Drupal Commons.

Thanks,
Curt

mstef’s picture

Well..

Three of those things will happen on a normal Drupal installation; not just Commons.

The first one shouldn't happen. Are you sure you completely cleared the cache before testing? Well, it shouldn't happen for the default images. Does it happen with default images, uploaded, or both?

If it's the uploaded images, it'll happen on any Drupal installation.

The Drupal installer should detect your files directory. I don't believe it will automatically default to /sites/default/files. If you have /sites//files, it should go there.

Mel55113’s picture

Let's take a step back here and differentiate between installing using the default profile and the DC profile.

If an installation is created using the default profile then NO content is generated, Image Cache isn't installed, no custom content types are created, CSS and JS aggregation are turned off, etc. The files directory will be something like /sites/site-name/files, but there won't be anything in it. Therefore, changing the files directory location can be done harmlessly immediately following installation.

In a DC installation, the administrator doesn't have the opportunity to specify the location of the files directory until AFTER the actions of the DC profile have configured Image Cache, created content types, created an Our Community group, etc. Therefore, changing the location/name of the files directory isn't a trivial task.

The fact that the DC Profile creates content and configures modules is why I think this is a valid feature request for DC.

Wolfflow’s picture

Sorry for quick jump in.

Hi @Mel55113 but allow me to say that I notice the same quite disturbing development case many time as not years ago. I found a simple solution:

When I develop a Drupal site that later I have to migrate to my client host I take care in most cases if possible to know at the beginning, where should the site migrate to, ie domain, sub-domain, so it very easy for an expert Web-Server Administrator to start building at a local server a clone virtual-host that have the same URL address. Using this way of developing avoid me when migrating later to have wrong paths at all.

Kind Regards

japerry’s picture

Version: » 7.x-3.x-dev
Issue summary: View changes
Issue tags: +commons 7.x-3.6 radar

Elevating this to the 3.6 radar because it has to do with public/private files and media. We should address this one way or another.

japerry’s picture

Pushing to the 3.7 radar. We should tackle this after we get media integrated.

Wolfflow’s picture

Status: Active » Needs review

Just gave a quick look on the Drupal Common distribution landing project node.

1. following the link feedback on documentation
have result Page not found so just gain a bit of work to edit a new miss-linked information issue to doc or maintainer.

2. After so much time i myself know how to create, build or modify distribution profiles by scratch,
so the best reference i found quickly is Configuration packaging and features

So i think this issue could be change to: needs rewiew