--- demo.module 2008-05-07 15:14:16.000000000 -0400
+++ demo.module-dump-path-append-site-optional 2008-05-09 14:30:51.000000000 -0400
@@ -150,7 +150,13 @@ function demo_admin_settings() {
'#title' => t('Dump path'),
'#default_value' => $fileconfig['path'],
'#size' => 30,
- '#description' => t('Enter a writable directory where dump files of this demonstration site are stored, f.e. %files. The name of this site (e.g. %confpath) is automatically appended to this directory.
Note: For security reasons you should store site dumps outside of the document root of your webspace!', array('%files' => file_directory_path() .'/demo', '%confpath' => $fileconfig['site'])),
+ '#description' => t('Enter a writable directory where dump files of this demonstration site are stored, f.e. %files.
Note: For security reasons you should store site dumps outside of the document root of your webspace!', array('%files' => file_directory_path() .'/demo')),
+ );
+ $form['dump']['path_append_site'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Append site name to dump path?'),
+ '#default_value' => variable_get("demo_dump_path_append_site",0),
+ '#description' => t('Automatically append the site name to the dump path (e.g. %files%confpath)?', array('%files' => file_directory_path() .'/demo', '%confpath' => $fileconfig['site'])),
);
$form[] = array(
'#type' => 'submit',
@@ -168,6 +174,7 @@ function demo_admin_settings_submit($for
else {
variable_set('demo_dump_path', $values['path']);
}
+ variable_set('demo_dump_path_append_site', $values['path_append_site']);
variable_set('demo_reset_interval', $values['interval']);
drupal_set_message(t('The configuration options have been saved.'));
}
@@ -363,7 +370,7 @@ function demo_get_fileconfig($filename =
// Build dump path.
$fileconfig['path'] = variable_get('demo_dump_path', file_directory_path() .'/demo');
- $fileconfig['site'] = str_replace('sites', '', conf_path());
+ $fileconfig['site'] = variable_get('demo_dump_path_append_site',0) ? str_replace('sites', '', conf_path()) : "";
$fileconfig['dumppath'] = $fileconfig['path'] . $fileconfig['site'];
// Check if directory exists.