You are here

public static function FileStorage::htaccessLines in Drupal 8

Returns the standard .htaccess lines that Drupal writes to file directories.

Parameters

bool $private: (optional) Set to FALSE to return the .htaccess lines for an open and public directory. The default is TRUE, which returns the .htaccess lines for a private and protected directory.

Return value

string The desired contents of the .htaccess file.

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Instead use \Drupal\Component\FileSecurity\FileSecurity.

See also

https://www.drupal.org/node/3075098

file_save_htaccess()

1 call to FileStorage::htaccessLines()
FileStorageDeprecationTest::testHtAccessLines in core/tests/Drupal/Tests/Component/PhpStorage/FileStorageDeprecationTest.php
@expectedDeprecation htaccessLines() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Component\FileSecurity\FileSecurity::htaccessLines() instead. See https://www.drupal.org/node/3075098

File

core/lib/Drupal/Component/PhpStorage/FileStorage.php, line 75

Class

FileStorage
Stores the code as regular PHP files.

Namespace

Drupal\Component\PhpStorage

Code

public static function htaccessLines($private = TRUE) {
  @trigger_error("htaccessLines() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \\Drupal\\Component\\FileSecurity\\FileSecurity::htaccessLines() instead. See https://www.drupal.org/node/3075098", E_USER_DEPRECATED);
  return FileSecurity::htaccessLines($private);
}