diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-11-01 16:31:09 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-11-01 16:31:09 +0000 |
commit | 46abc88ee4513d8fd52f7e3ef9a68ff415131dff (patch) | |
tree | e0e7d5e05cf7f6284fdc49bf59deb8a05da94068 | |
parent | a8b218827a400cf5ced7db133be0a0f9e2180875 (diff) | |
download | brdo-46abc88ee4513d8fd52f7e3ef9a68ff415131dff.tar.gz brdo-46abc88ee4513d8fd52f7e3ef9a68ff415131dff.tar.bz2 |
- Patch #26249 by crunchywelch, Junyor: use upload_tmp_dir as default temporary directory. Fixed file problems on Windows NT systems.
-rw-r--r-- | includes/file.inc | 8 | ||||
-rw-r--r-- | modules/system.module | 2 | ||||
-rw-r--r-- | modules/system/system.module | 2 |
3 files changed, 5 insertions, 7 deletions
diff --git a/includes/file.inc b/includes/file.inc index b57d4423b..378582c39 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -12,12 +12,10 @@ * Common file handling functions. */ -define('IS_WINDOWS', substr(PHP_OS, 0, 3) == 'WIN'); define('FILE_DOWNLOADS_PUBLIC', 1); define('FILE_DOWNLOADS_PRIVATE', 2); define('FILE_CREATE_DIRECTORY', 1); define('FILE_MODIFY_PERMISSIONS', 2); -define('FILE_DIRECTORY_TEMP', IS_WINDOWS ? 'c:\\windows\\temp' : '/tmp'); define('FILE_EXISTS_RENAME', 0); define('FILE_EXISTS_REPLACE', 1); define('FILE_EXISTS_ERROR', 2); @@ -59,7 +57,7 @@ function file_create_path($dest = 0) { return $dest; } // check if the destination is instead inside the Drupal temporary files directory. - else if (file_check_location($dest, variable_get('file_directory_temp', FILE_DIRECTORY_TEMP))) { + else if (file_check_location($dest, variable_get('file_directory_temp', ini_get('upload_tmp_dir')))) { return $dest; } // Not found, try again with prefixed dirctory path. @@ -363,7 +361,7 @@ function file_save_upload($source, $dest = 0, $replace = FILE_EXISTS_RENAME) { // Make sure $source exists in $_FILES. if ($file = file_check_upload($source)) { if (!$dest) { - $dest = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP); + $dest = variable_get('file_directory_temp', ini_get('upload_tmp_dir')); $temporary = 1; if (is_file($file->filepath)) { // If this file was uploaded by this user before replace the temporary copy. @@ -421,7 +419,7 @@ function file_save_data($data, $dest, $replace = FILE_EXISTS_RENAME) { return 0; } - $temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP); + $temp = variable_get('file_directory_temp', ini_get('upload_tmp_dir')); $file = tempnam($temp, 'file'); if (!$fp = fopen($file, 'wb')) { drupal_set_message(t('The file could not be created.'), 'error'); diff --git a/modules/system.module b/modules/system.module index c91f4b531..9fa32b0a0 100644 --- a/modules/system.module +++ b/modules/system.module @@ -325,7 +325,7 @@ function system_view_general() { '#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.') ); - $directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP); + $directory_temp = variable_get('file_directory_temp', ini_get('upload_tmp_dir')); file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp'); $form['files']['file_directory_temp'] = array( diff --git a/modules/system/system.module b/modules/system/system.module index c91f4b531..9fa32b0a0 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -325,7 +325,7 @@ function system_view_general() { '#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.') ); - $directory_temp = variable_get('file_directory_temp', FILE_DIRECTORY_TEMP); + $directory_temp = variable_get('file_directory_temp', ini_get('upload_tmp_dir')); file_check_directory($directory_temp, FILE_CREATE_DIRECTORY, 'file_directory_temp'); $form['files']['file_directory_temp'] = array( |