summaryrefslogtreecommitdiff
path: root/includes/file.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-06-14 13:33:45 +0000
committerDries Buytaert <dries@buytaert.net>2010-06-14 13:33:45 +0000
commitf6d56f96c306a9e9ec3202c087321edc39d65b03 (patch)
tree2e530fa7f3722dfb7da23aa93acc905f3a460b4d /includes/file.inc
parent6c934509fe49103631ef05d59f99088788bb1b35 (diff)
downloadbrdo-f6d56f96c306a9e9ec3202c087321edc39d65b03.tar.gz
brdo-f6d56f96c306a9e9ec3202c087321edc39d65b03.tar.bz2
- Patch #551658 by Stevel: improve directory testing.
Diffstat (limited to 'includes/file.inc')
-rw-r--r--includes/file.inc10
1 files changed, 7 insertions, 3 deletions
diff --git a/includes/file.inc b/includes/file.inc
index dc6b53e96..6910865cc 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -1982,7 +1982,11 @@ function file_directory_temp() {
$path_delimiter = '/';
}
// PHP may be able to find an alternative tmp directory.
- $directories[] = sys_get_temp_dir();
+ // This function exists in PHP 5 >= 5.2.1, but Drupal
+ // requires PHP 5 >= 5.2.0, so we check for it.
+ if (function_exists('sys_get_temp_dir')) {
+ $directories[] = sys_get_temp_dir();
+ }
foreach ($directories as $directory) {
if (is_dir($directory) && is_writable($directory)) {
@@ -1991,9 +1995,9 @@ function file_directory_temp() {
}
}
- // if a directory has been found, use it, otherwise default to 'files/tmp' or 'files\\tmp';
+ // if a directory has been found, use it, otherwise default to 'files/tmp' or 'files\\tmp'.
if (empty($temporary_directory)) {
- $temporary_directory = file_directory_path() . $path_delimiter .'tmp';
+ $temporary_directory = file_directory_path() . $path_delimiter . 'tmp';
}
// Save the path of the discovered directory.
variable_set('file_directory_temp', $temporary_directory);