function file_ensure_htaccess

Creates a .htaccess file in each Drupal files directory if it is missing.

Related topics

4 calls to file_ensure_htaccess()
FileDirectoryTest::testFileCheckDirectoryHandling in drupal/modules/simpletest/tests/file.test
Test directory handling functions.
file_unmanaged_copy in drupal/includes/file.inc
Copies a file to a new location without invoking the file API.
install_system_module in drupal/includes/install.core.inc
Installation task; install the Drupal system module.
system_requirements in drupal/modules/system/system.install
Implements hook_requirements().

File

drupal/includes/file.inc, line 459
API for handling file uploads and server file management.

Code

function file_ensure_htaccess() {
  file_create_htaccess('public://', FALSE);
  if (variable_get('file_private_path', FALSE)) {
    file_create_htaccess('private://', TRUE);
  }
  file_create_htaccess('temporary://', TRUE);
}