function FileSecurity::writeWebConfig

Same name in this branch
  1. 8.9.x composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::writeWebConfig()
Same name in other branches
  1. 9 composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::writeWebConfig()
  2. 9 core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::writeWebConfig()
  3. 10 composer/Plugin/VendorHardening/FileSecurity.php \Drupal\Composer\Plugin\VendorHardening\FileSecurity::writeWebConfig()
  4. 10 core/lib/Drupal/Component/FileSecurity/FileSecurity.php \Drupal\Component\FileSecurity\FileSecurity::writeWebConfig()

Writes a web.config file in the given directory, if it doesn't exist.

Parameters

string $directory: The directory.

bool $force: (optional) Set to TRUE to force overwrite an existing file.

Return value

bool TRUE if the file already exists or was created. FALSE otherwise.

4 calls to FileSecurity::writeWebConfig()
Composer::ensureHtaccess in core/lib/Drupal/Core/Composer/Composer.php
Ensures that .htaccess and web.config files are present in Composer root.
FileSecurityTest::testWriteWebConfig in core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
@covers ::writeWebConfig
FileSecurityTest::testWriteWebConfigFailure in core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
@covers ::writeWebConfig
FileSecurityTest::testWriteWebConfigForceOverwrite in core/tests/Drupal/Tests/Component/FileSecurity/FileSecurityTest.php
@covers ::writeWebConfig

File

core/lib/Drupal/Component/FileSecurity/FileSecurity.php, line 112

Class

FileSecurity
Provides file security functions.

Namespace

Drupal\Component\FileSecurity

Code

public static function writeWebConfig($directory, $force = FALSE) {
    return self::writeFile($directory, 'web.config', self::webConfigLines(), $force);
}

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