summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-11-13 07:57:11 +0000
committerDries Buytaert <dries@buytaert.net>2005-11-13 07:57:11 +0000
commite6e349202919c903e16aced52198621883fc7e96 (patch)
treedf4a444b02691784cec4aab015db7e12677aae15
parent534805718ae542a47e222e0924263bd145dc08b5 (diff)
downloadbrdo-e6e349202919c903e16aced52198621883fc7e96.tar.gz
brdo-e6e349202919c903e16aced52198621883fc7e96.tar.bz2
- Patch #35575 by Richard, chx and Ber: system module no longer saves the files and tmp dir.:
-rw-r--r--modules/system.module39
-rw-r--r--modules/system/system.module39
2 files changed, 58 insertions, 20 deletions
diff --git a/modules/system.module b/modules/system.module
index 4500dc3c6..e39cf9e07 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -317,20 +317,22 @@ function system_view_general() {
// File system:
$form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
- $directory_path = file_directory_path();
- file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
-
$form['files']['file_directory_path'] = array(
- '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => $directory_path, '#maxlength' => 255, '#valid' => 'directory',
- '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
+ '#type' => 'textfield',
+ '#title' => t('File system path'),
+ '#default_value' => file_directory_path(),
+ '#maxlength' => 255,
+ '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
+ '#post_process' => 'system_check_directory',
);
- $directory_temp = file_directory_temp();
- file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp');
-
$form['files']['file_directory_temp'] = array(
- '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => $directory_temp, '#maxlength' => 255, '#valid' => 'directory',
- '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
+ '#type' => 'textfield',
+ '#title' => t('Temporary directory'),
+ '#default_value' => file_directory_temp(),
+ '#maxlength' => 255,
+ '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the Drupal installation directory.'),
+ '#post_process' => 'system_check_directory',
);
$form['files']['file_downloads'] = array(
@@ -458,6 +460,23 @@ function system_view_general() {
}
/**
+ * Checks the existence of the directory specified in $form_element. This
+ * function is called from the system_view_general form to check both the
+ * file_directory_path and file_directory_temp directories. If validation
+ * fails, the form element is flagged with an error from within the
+ * file_check_directory function.
+ *
+ * @param $form_id
+ * The id of the form.
+ * @param $form_element
+ * The form element containing the name of the directory to check.
+ */
+function system_check_directory($form_id, $form_element) {
+ file_check_directory($form_element['#value'], FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
+ return $form_element;
+}
+
+/**
* Retrieves the current status of an array of files in the system table.
*/
function system_get_files_database(&$files, $type) {
diff --git a/modules/system/system.module b/modules/system/system.module
index 4500dc3c6..e39cf9e07 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -317,20 +317,22 @@ function system_view_general() {
// File system:
$form['files'] = array('#type' => 'fieldset', '#title' => t('File system settings'), '#collapsible' => TRUE, '#collapsed' => TRUE);
- $directory_path = file_directory_path();
- file_check_directory($directory_path, FILE_CREATE_DIRECTORY, 'file_directory_path');
-
$form['files']['file_directory_path'] = array(
- '#type' => 'textfield', '#title' => t('File system path'), '#default_value' => $directory_path, '#maxlength' => 255, '#valid' => 'directory',
- '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.')
+ '#type' => 'textfield',
+ '#title' => t('File system path'),
+ '#default_value' => file_directory_path(),
+ '#maxlength' => 255,
+ '#description' => t('A file system path where the files will be stored. This directory has to exist and be writable by Drupal. If the download method is set to public this directory has to be relative to Drupal installation directory, and be accessible over the web. When download method is set to private this directory should not be accessible over the web. Changing this location after the site has been in use will cause problems so only change this setting on an existing site if you know what you are doing.'),
+ '#post_process' => 'system_check_directory',
);
- $directory_temp = file_directory_temp();
- file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp');
-
$form['files']['file_directory_temp'] = array(
- '#type' => 'textfield', '#title' => t('Temporary directory'), '#default_value' => $directory_temp, '#maxlength' => 255, '#valid' => 'directory',
- '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the file system path.')
+ '#type' => 'textfield',
+ '#title' => t('Temporary directory'),
+ '#default_value' => file_directory_temp(),
+ '#maxlength' => 255,
+ '#description' => t('Location where uploaded files will be kept during previews. Relative paths will be resolved relative to the Drupal installation directory.'),
+ '#post_process' => 'system_check_directory',
);
$form['files']['file_downloads'] = array(
@@ -458,6 +460,23 @@ function system_view_general() {
}
/**
+ * Checks the existence of the directory specified in $form_element. This
+ * function is called from the system_view_general form to check both the
+ * file_directory_path and file_directory_temp directories. If validation
+ * fails, the form element is flagged with an error from within the
+ * file_check_directory function.
+ *
+ * @param $form_id
+ * The id of the form.
+ * @param $form_element
+ * The form element containing the name of the directory to check.
+ */
+function system_check_directory($form_id, $form_element) {
+ file_check_directory($form_element['#value'], FILE_CREATE_DIRECTORY, $form_element['#parents'][0]);
+ return $form_element;
+}
+
+/**
* Retrieves the current status of an array of files in the system table.
*/
function system_get_files_database(&$files, $type) {