Skip to content
Snippets Groups Projects
Commit 99527b1e authored by catch's avatar catch
Browse files

Issue #2332047 by xjm: Deprecate unneeded file_htaccess_lines() wrapper

parent f85c9e4b
No related branches found
No related tags found
No related merge requests found
......@@ -456,7 +456,7 @@ function file_save_htaccess($directory, $private = TRUE, $force_overwrite = FALS
// Short circuit if the .htaccess file already exists.
return TRUE;
}
$htaccess_lines = file_htaccess_lines($private);
$htaccess_lines = FileStorage::htaccessLines($private);
// Write the .htaccess file.
if (file_exists($directory) && is_writable($directory) && file_put_contents($htaccess_path, $htaccess_lines)) {
......@@ -480,7 +480,8 @@ function file_save_htaccess($directory, $private = TRUE, $force_overwrite = FALS
* @return string
* The desired contents of the .htaccess file.
*
* @see file_create_htaccess()
* @deprecated in Drupal 8.0.x-dev and will be removed before Drupal 9.0.0.
* Use \Drupal\Component\PhpStorage\FileStorage::htaccessLines().
*/
function file_htaccess_lines($private = TRUE) {
return FileStorage::htaccessLines($private);
......
......@@ -66,16 +66,15 @@ public function save($name, $code) {
/**
* Returns the standard .htaccess lines that Drupal writes to file directories.
*
* This code is located here so this component can be stand-alone, but it is
* also called by file_htaccess_lines().
*
* @param bool $private
* (Optional) Set to FALSE to return the .htaccess lines for an open and
* (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 string
* The desired contents of the .htaccess file.
*
* @see file_create_htaccess()
*/
public static function htaccessLines($private = TRUE) {
$lines = <<<EOF
......
......@@ -7,6 +7,8 @@
namespace Drupal\system\Tests\File;
use Drupal\Component\PhpStorage\FileStorage;
/**
* Tests operations dealing with directories.
*
......@@ -93,7 +95,7 @@ function testFileCheckDirectoryHandling() {
$this->assertTrue(is_file(file_default_scheme() . '://.htaccess'), 'Successfully re-created the .htaccess file in the files directory.', 'File');
// Verify contents of .htaccess file.
$file = file_get_contents(file_default_scheme() . '://.htaccess');
$this->assertEqual($file, file_htaccess_lines(FALSE), 'The .htaccess file contains the proper content.', 'File');
$this->assertEqual($file, FileStorage::htaccessLines(FALSE), 'The .htaccess file contains the proper content.', 'File');
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment