Commit 57759f5a authored by webchick's avatar webchick

#930122 by dww: Regression: temp directory handling broken by confusion...

#930122 by dww: Regression: temp directory handling broken by confusion between file_directory_temp and file_temporary_path.
parent 5d760089
......@@ -2277,9 +2277,9 @@ function drupal_tempnam($directory, $prefix) {
* Get the path of system-appropriate temporary directory.
*/
function file_directory_temp() {
$temporary_directory = variable_get('file_directory_temp', NULL);
$temporary_directory = variable_get('file_temporary_path', NULL);
if (!isset($temporary_directory)) {
if (empty($temporary_directory)) {
$directories = array();
// Has PHP been set with an upload_tmp_dir?
......@@ -2316,7 +2316,7 @@ function file_directory_temp() {
$temporary_directory = variable_get('file_public_path', conf_path() . '/files') . $path_delimiter . 'tmp';
}
// Save the path of the discovered directory.
variable_set('file_directory_temp', $temporary_directory);
variable_set('file_temporary_path', $temporary_directory);
}
return $temporary_directory;
......
......@@ -972,8 +972,19 @@ class FileDirectoryTest extends FileTestCase {
$path = file_destination($destination, FILE_EXISTS_ERROR);
$this->assertEqual($path, FALSE, t('An error is returned when filepath destination already exists with FILE_EXISTS_ERROR.'), 'File');
}
}
/**
* Ensure that the file_directory_temp() function always returns a value.
*/
function testFileDirectoryTemp() {
// Start with an empty variable to ensure we have a clean slate.
variable_set('file_temporary_path', '');
$tmp_directory = file_directory_temp();
$this->assertEqual(empty($tmp_directory), FALSE, t('file_directory_temp() returned a non-empty value.'));
$setting = variable_get('file_temporary_path', '');
$this->assertEqual($setting, $tmp_directory, t("The 'file_temporary_path' variable has the same value that file_directory_temp() returned."));
}
}
/**
* Tests the file_scan_directory() function.
......
......@@ -2069,9 +2069,10 @@ function system_admin_menu_block($item) {
}
/**
* Checks the existence of the directory specified in $form_element. This
* function is called from the system_settings form to check both core file
* directories (file_public_path, file_private_path, file_temporary_path).
* Checks the existence of the directory specified in $form_element.
*
* This function is called from the system_settings form to check all core
* file directories (file_public_path, file_private_path, file_temporary_path).
*
* @param $form_element
* The form element containing the name of the directory to check.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment