diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-30 01:33:17 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-04-30 01:33:17 +0000 |
commit | a724915f82a0c25cabe60561cd9b4f7f72541734 (patch) | |
tree | 6601c55abe4005404aec5ef7f3aa94e74fd93411 /modules/system/system.module | |
parent | d97f4bdba3e29ea63f488e56f5141a203b7b2171 (diff) | |
download | brdo-a724915f82a0c25cabe60561cd9b4f7f72541734.tar.gz brdo-a724915f82a0c25cabe60561cd9b4f7f72541734.tar.bz2 |
#551658 by pwolanin, aaron, drewish: Move private files to an opt-in system, and no longer force private files to live within web-accessible directory.
Diffstat (limited to 'modules/system/system.module')
-rw-r--r-- | modules/system/system.module | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/modules/system/system.module b/modules/system/system.module index f24c3af9c..21ad835fc 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -1517,24 +1517,30 @@ function system_library() { * Implements hook_stream_wrappers(). */ function system_stream_wrappers() { - return array( + $wrappers = array( 'public' => array( 'name' => t('Public files'), 'class' => 'DrupalPublicStreamWrapper', 'description' => t('Public local files served by the webserver.'), ), - 'private' => array( - 'name' => t('Private files'), - 'class' => 'DrupalPrivateStreamWrapper', - 'description' => t('Private local files served by Drupal.'), - ), 'temporary' => array( 'name' => t('Temporary files'), 'class' => 'DrupalTemporaryStreamWrapper', 'description' => t('Temporary local files for upload and previews.'), 'type' => STREAM_WRAPPERS_HIDDEN, - ) + ), ); + + // Only register the private file stream wrapper if a file path has been set. + if (variable_get('file_private_path', FALSE)) { + $wrappers['private'] = array( + 'name' => t('Private files'), + 'class' => 'DrupalPrivateStreamWrapper', + 'description' => t('Private local files served by Drupal.'), + ); + } + + return $wrappers; } /** @@ -2046,6 +2052,9 @@ function system_admin_menu_block($item) { */ function system_check_directory($form_element) { $directory = $form_element['#value']; + if (strlen($directory) == 0) { + return $form_element; + } if (!is_dir($directory) && !drupal_mkdir($directory, NULL, TRUE)) { // If the directory does not exists and cannot be created. @@ -2058,7 +2067,7 @@ function system_check_directory($form_element) { form_set_error($form_element['#parents'][0], t('The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory))); watchdog('file system', 'The directory %directory exists but is not writable and could not be made writable.', array('%directory' => $directory), WATCHDOG_ERROR); } - else { + elseif (is_dir($directory)) { if ($form_element['#name'] == 'file_public_path') { // Create public .htaccess file. file_create_htaccess($directory, FALSE); |