file_ensure_htaccess

  1. drupal
    1. 8
    2. 7
Versions
7 – 8 file_ensure_htaccess()

If missing, create a .htaccess file in each Drupal files directory.

Related topics

▾ 2 functions call 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.

Code

includes/file.inc, line 464

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