function file_ensure_htaccess

Same name in other branches
  1. 8.9.x 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 466

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.