From 99527b1ed4b40a1b30cde57d601c1c471a392325 Mon Sep 17 00:00:00 2001 From: catch <git config --global user.email catch@35733.no-reply.drupal.org> Date: Sat, 21 Feb 2015 18:04:49 +0000 Subject: [PATCH] Issue #2332047 by xjm: Deprecate unneeded file_htaccess_lines() wrapper --- core/includes/file.inc | 5 +++-- core/lib/Drupal/Component/PhpStorage/FileStorage.php | 7 +++---- core/modules/system/src/Tests/File/DirectoryTest.php | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/includes/file.inc b/core/includes/file.inc index 79914af51c9f..36204b05e8c4 100644 --- a/core/includes/file.inc +++ b/core/includes/file.inc @@ -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); diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php index 78f1222f98c5..71ff3f274be3 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php @@ -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 diff --git a/core/modules/system/src/Tests/File/DirectoryTest.php b/core/modules/system/src/Tests/File/DirectoryTest.php index acbea60c4e3e..08220630f1ee 100644 --- a/core/modules/system/src/Tests/File/DirectoryTest.php +++ b/core/modules/system/src/Tests/File/DirectoryTest.php @@ -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'); } /** -- GitLab