diff options
-rw-r--r-- | includes/file.inc | 10 | ||||
-rw-r--r-- | modules/system/system.install | 12 |
2 files changed, 18 insertions, 4 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); diff --git a/modules/system/system.install b/modules/system/system.install index c6d0470f5..68dd8182b 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -269,8 +269,18 @@ function system_requirements($phase) { // By default no private files directory is configured. For private files // to be secure the admin needs to provide a path outside the webroot. variable_get('file_private_path', FALSE), - variable_get('file_temporary_path', sys_get_temp_dir()), ); + + // Do not check for the temporary files directory at install time + // unless it has been set in settings.php. In this case the user has + // no alternative but to fix the directory if it is not writable. + if ($phase == 'install') { + $directories[] = variable_get('file_temporary_path', FALSE); + } + else { + $directories[] = variable_get('file_temporary_path', file_directory_temp()); + } + $requirements['file system'] = array( 'title' => $t('File system'), ); |