Change record status: 
Project: 
Introduced in branch: 
8.8.x
Introduced in version: 
8.8.0-alpha1
Description: 
  • file_ensure_htaccess() should now use \Drupal::service('file.htaccess_writer')->ensure().
  • file_save_htaccess() should now use \Drupal\Component\FileSecurity\FileSecurity::writeHtaccess() instead.

Please note: \Drupal\Component\FileSecurity\FileSecurity::writeHtaccess() does not normalize streamwrappers, trim trailing slashes, nor log error messages if the file cannot be written. Calling code should handle that appropriately.

Old function New method
file_ensure_htaccess() \Drupal\Core\File\HtaccessWriterInterface::ensure()
file_save_htaccess() \Drupal\Component\FileSecurity\FileSecurity::writeHtaccess()

The file_htaccess_lines() was replaced with \Drupal\Component\FileSecurity\FileSecurity::htaccessLines() see Htaccess lines moved to new FileSecurity component

Impacts: 
Module developers