[development] Why is the Drupal File System relative to website root and not relative to admin/settings/file-system path?
Jamie Holly
hovercrafter at earthlink.net
Thu Jul 16 14:19:02 UTC 2009
There's also benefits to it being absolute. If my /files folder is
becoming bloated and I decide I want to start a fresh files directory
all I have to do is change the file path inside admin. All my old file
paths will still be intact. Making it relative would then break the
archived /files path.
If moving the file system were actually that common of an occurrence
then I could see this being a big problem. But to do things like moving
from a development/staging area to a production area a simple query does
the trick:
UPDATE files SET filepath=REPLACE(filepath,
'/sites/www.oldserver.com/file', '/sites/www.newserver.com/file');
User pictures:
UPDATE users SET picture=REPLACE(picture,
'/sites/www.oldserver.com/file', '/sites/www.newserver.com/file');
This has never been a problem for me when it comes to having to move a
file system.
Jamie Holly
http://www.intoxination.net
http://www.hollyit.net
Ashraf Amayreh wrote:
> I don't really understand why the files are not just stored relative
> to the files folder rather than the site root.
>
> That way, changing the location of the files folder would only entail
> changing the file path inside the administration.
>
> When retrieving file paths the function doing that could simply call
> file_directory_path() and append the filepath from the database. Isn't
> this how it should standardly be dealt with, or did I miss something?
>
> AA
>
> On Thu, Jul 16, 2009 at 4:40 PM, Earnie Boyd
> <earnie at users.sourceforge.net <mailto:earnie at users.sourceforge.net>>
> wrote:
>
> Quoting Luc Stroobant <lstroobant at gmail.com
> <mailto:lstroobant at gmail.com>>:
>
> Clemens Tolboom wrote:
>
> Having a development test acceptance and production
> environment it's a
> drag when moving the production database and files to an
> acceptance or
> development environment.
>
> One has to update the files database table and more tables
> or do
> trickery with symlinks to get the site running clean.
>
> If we could make the filepath in the files table relative to
> the /admin/settings/file-system path the real files are
> relocatable
> without pain. Just do a db load and a rsync to get the
> files and change
> the dmin/settings/file-system path.
>
> What do you think? Did I miss something important?
>
>
> On *nix you can easily workaround this problem by creating
> your site directory as sites/sitename and adding the actual
> urls as symlinks
>
> So you get something as
>
> directory: mysite
> link: www.mysite.com <http://www.mysite.com> -> mysite
> link: dev.mysite.com <http://dev.mysite.com> -> mysite
>
> entries in the files table will always look like
> sites/mysite/files/file.ext
> and are the same for dev and prod...
>
>
> And on windows
>
> junction www.mysite.com <http://www.mysite.com> mysite
> junction dev.mysite.com <http://dev.mysite.com> mysite
>
> --
> Earnie
> -- http://r-feed.com/ -- http://for-my-kids.com/
> -- http://www.4offer.biz/ -- http://give-me-an-offer.com/
>
>
>
>
>
> --
> Ashraf Amayreh
> http://aamayreh.org
More information about the development
mailing list