Do not store dumps for default site in a sub-directory

sigsby - May 9, 2008 - 18:46
Project:Demonstration site (Sandbox / Snapshot)
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed
Description

I default all of my per site files to the sites directory (e.g. sites//files), so it's rather annoying to have Demo append the site directory name to my dump path.

This could easily be solved by adding a checkbox in the admin settings to enable/disable appending the site directory name. I've attempted to add this myself and I'm including a patch against the 5.x-1.4 version.

Patch adds the necessary changes for the option and modifies the description for the dump path form item, removing the text about automatically adding the site name to the dump path.

AttachmentSize
demo.module-dump-path-append-site-optional.patch2.22 KB

#1

sun - May 9, 2008 - 22:34
Title:Make appending site name to dump path optional.» Do not store dumps for default site in a sub-directory
Status:needs review» needs work

I agree. However, I think you are referring to the 'default' site in single-site setups.

So the solution would be to store all dumps for the default site directly in files/demo. Dumps for other sites should automatically be stored in a sub-directory. Thus, no need for an option, and more importantly, no chance for users to configure this wrong.

#2

sigsby - May 14, 2008 - 23:35

Not really sure what you mean. I know the standard drupal install wants to put all files in drupal-root/files, but that's not very handy for multisite setups (like I run), and I believe most multisite developers put the files in drupal-root/sites/site-dir/files (at least I do). So having Demo automatically append the site folder name is redundant, e.g. drupal-root/sites/site-dir/files/site-dir. In addition, I don't even put my snapshots in the files folder, I put them in drupal-root/sites/site-dir/snapshots (though I get the sensibility of defaulting to a path Drupal can write to).

I'm not so sure my patch is the best approach. I do feel that things should not be done automatically, without the ability to override the behavior. Just my two cents.

If there are better ideas out there I'm willing to have a go at implementing them. If there is no interest in changing this behavior, I'll just have to live with it and roll my own patch for every update.

In any case it's a great module. I've already been using it heavily as a part of my development process. Whatever the conclusion, thanks for the work you've put into producing a really useful tool. Now to have a go at including files in the snapshot... :-)

#3

sun - May 15, 2008 - 00:07

I see. Actually, I'm not using different file paths for multi-site setups currently. Of course, using ./sites/<site>/files/ is legitimate, too.

In #1 I was referring to the unnecessary sub-folder in single-site setups: For the default site, demo creates a snapshot path ./files/demo/default/, which could simply be ./files/demo/ for the default site, but ./files/demo/<site>/ for any other site.

To complete this, we should check whether file_directory_path contains the site name already. If it does, Demo should not append the site name to the snapshot path. Additionally, Demo should not append the site name, if the site name is default.

#4

smk-ka - October 28, 2008 - 19:37

Couldn't we just check whether the files path starts with site/<site>, and not append <site> if that's the case? Adding a configuration option seems overkill to me, and most likely of no value for 98% of our users.

#5

pvhee - February 25, 2009 - 22:33

Thanks for the great module. I find it however a bit counterintuitive to store the database dump in a subfolder while you explicitly state in which folder the dump should be stored. I would like to use the module in an installation profile with a dump file stored in a certain location, and the fact I cannot refer to that certain file is a bit limiting.

#6

luco - April 28, 2009 - 21:04

I aggree with smk-ka.

simply change

- sites/default/files/demo/default/file_name.sql

- sites/foo.com/files/demo/foo.com/file_name.sql

- sites/bar.com/files/demo/bar.com/file_name.sql

into

- sites/default/files/demo/file_name.sql

- sites/foo.com/files/demo/file_name.sql

- sites/bar.com/files/demo/file_name.sql

why get any messier? ;)

#7

smk-ka - May 14, 2009 - 16:24
Version:5.x-1.4» 6.x-1.x-dev
Status:needs work» needs review

Implemented what luco said ;)
Please test the update process and creating dumps still works.

AttachmentSize
demo-skip-subdir-D6.patch 3.9 KB

#8

sun - May 16, 2009 - 17:45
Status:needs review» fixed

I've tested this, added another test to also avoid a site name sub-directory in case of 'sites/all/files' being the file directory path, works, and committed to 6.x and 7.x.

Good job. This ensures that people upgrading from 5.x, who most probably can't change their file directory path easily, will still have the site name in the path.

#9

sun - May 16, 2009 - 18:18

That said, exactly that last bit did not work, since the wrong path was being tested. Committed attached patch.

AttachmentSize
demo-DRUPAL-6--1.dump-path-regression.patch 1.88 KB

#10

System Message - May 30, 2009 - 18:20
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.