You are here

function file_ensure_htaccess in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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()
DirectoryTest::testFileCheckDirectoryHandling in core/modules/system/src/Tests/File/DirectoryTest.php
Test directory handling functions.
file_unmanaged_copy in core/includes/file.inc
Copies a file to a new location without invoking the file API.
install_base_system in core/includes/install.core.inc
Installation task; install the base functionality Drupal needs to bootstrap.
system_requirements in core/modules/system/system.install
Implements hook_requirements().

File

core/includes/file.inc, line 328
API for handling file uploads and server file management.

Code

function file_ensure_htaccess() {
  file_save_htaccess('public://', FALSE);
  $private_path = PrivateStream::basePath();
  if (!empty($private_path)) {
    file_save_htaccess('private://', TRUE);
  }
  file_save_htaccess('temporary://', TRUE);
  file_save_htaccess(config_get_config_directory(CONFIG_SYNC_DIRECTORY), TRUE);
}