You are here

function file_ensure_htaccess in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/file.inc \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 modules/simpletest/tests/file.test
Test directory handling functions.
file_unmanaged_copy in includes/file.inc
Copies a file to a new location without invoking the file API.
install_system_module in includes/install.core.inc
Installation task; install the Drupal system module.
system_requirements in modules/system/system.install
Implements hook_requirements().

File

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);
}