function FileSecurity::htaccessLines
Same name in this branch
- 10 composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::htaccessLines()
Same name in other branches
- 9 composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::htaccessLines()
- 9 core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::htaccessLines()
- 8.9.x composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::htaccessLines()
- 8.9.x core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::htaccessLines()
- 11.x composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::htaccessLines()
- 11.x core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::htaccessLines()
Returns the standard .htaccess lines that Drupal writes.
Parameters
bool $deny_public_access: (optional) Set to FALSE to return the .htaccess lines for an open and public directory that allows Apache to serve files, but not execute code. The default is TRUE, which returns the .htaccess lines for a private and protected directory that Apache will deny all access to.
Return value
string The desired contents of the .htaccess file.
See also
\Drupal\Component\FileSecurity\FileSecurity::writeHtaccess()
5 calls to FileSecurity::htaccessLines()
- DirectoryTest::testFileCheckDirectoryHandling in core/
tests/ Drupal/ KernelTests/ Core/ File/ DirectoryTest.php - Tests directory handling functions.
- FileSaveHtaccessLoggingTest::testHtaccessSave in core/
modules/ system/ tests/ src/ Functional/ File/ FileSaveHtaccessLoggingTest.php - Tests file_save_htaccess().
- FileSecurity::writeHtaccess in core/
lib/ Drupal/ Component/ FileSecurity/ FileSecurity.php - Writes an .htaccess file in the given directory, if it doesn't exist.
- HtaccessWriter::write in core/
lib/ Drupal/ Core/ File/ HtaccessWriter.php - Creates a .htaccess file in the given directory.
- MTimeProtectedFileStorageBase::testSecurity in core/
tests/ Drupal/ Tests/ Component/ PhpStorage/ MTimeProtectedFileStorageBase.php - Tests the security of the MTimeProtectedFileStorage implementation.
File
-
core/
lib/ Drupal/ Component/ FileSecurity/ FileSecurity.php, line 46
Class
- FileSecurity
- Provides file security functions.
Namespace
Drupal\Component\FileSecurityCode
public static function htaccessLines($deny_public_access = TRUE) {
$lines = static::htaccessPreventExecution();
if ($deny_public_access) {
$lines = static::denyPublicAccess() . "\n\n{$lines}";
}
return $lines;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.