diff --git a/original.patch b/original.patch index 2c71a22..d775e03 100644 --- a/original.patch +++ b/original.patch @@ -1,5 +1,5 @@ diff --git a/core/lib/Drupal/Component/PhpStorage/FileStorage.php b/core/lib/Drupal/Component/PhpStorage/FileStorage.php -index a07c27e..b8c3aad 100644 +index fcbbb7b..b8c3aad 100644 --- a/core/lib/Drupal/Component/PhpStorage/FileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/FileStorage.php @@ -22,11 +22,11 @@ class FileStorage implements PhpStorageInterface { @@ -29,7 +29,7 @@ index a07c27e..b8c3aad 100644 } /** -@@ -75,23 +78,49 @@ protected function getFullPath($name) { +@@ -75,27 +78,49 @@ protected function getFullPath($name) { /** * Implements Drupal\Component\PhpStorage\PhpStorageInterface::writeable(). */ @@ -42,6 +42,10 @@ index a07c27e..b8c3aad 100644 * Implements Drupal\Component\PhpStorage\PhpStorageInterface::deleteAll(). */ - function deleteAll() { +- // @todo remove this to properly decouple this class from Drupal. +- if (!function_exists('file_unmanaged_delete_recursive')) { +- include_once DRUPAL_ROOT . '/core/includes/file.inc'; +- } - return file_unmanaged_delete_recursive($this->directory, array(__CLASS__, 'filePreDeleteCallback')); + public function deleteAll() { + return $this->unlink($this->directory); @@ -85,7 +89,7 @@ index a07c27e..b8c3aad 100644 } } diff --git a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php b/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php -index 68a6205..4d564fb 100644 +index 908289a..4d564fb 100644 --- a/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php +++ b/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php @@ -4,6 +4,7 @@ @@ -96,19 +100,17 @@ index 68a6205..4d564fb 100644 namespace Drupal\Component\PhpStorage; use DirectoryIterator; -@@ -41,6 +42,11 @@ +@@ -40,6 +41,9 @@ + */ class MTimeProtectedFastFileStorage extends FileStorage { - /** ++ /** + * The .htaccess code to make a directory private. + */ -+ const HTACCESS="SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nDeny from all\nOptions None\nOptions +FollowSymLinks"; -+ -+ /** - * The secret used in the HMAC. - * - * @var string -@@ -50,7 +56,7 @@ class MTimeProtectedFastFileStorage extends FileStorage { + const HTACCESS="SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006\nDeny from all\nOptions None\nOptions +FollowSymLinks"; + + /** +@@ -52,7 +56,7 @@ class MTimeProtectedFastFileStorage extends FileStorage { /** * Constructs this MTimeProtectedFastFileStorage object. * @@ -117,7 +119,7 @@ index 68a6205..4d564fb 100644 * An associated array, containing at least these keys (the rest are * ignored): * - directory: The directory where the files should be stored. -@@ -108,7 +114,7 @@ public function save($name, $data) { +@@ -110,7 +114,7 @@ public function save($name, $data) { rename($full_path, $temporary_path); // Make sure to not loop infinitely on a hopelessly slow filesystem. if ($i > 10) { @@ -126,17 +128,7 @@ index 68a6205..4d564fb 100644 return FALSE; } } -@@ -144,20 +150,23 @@ protected function ensureDirectory() { - mkdir($this->directory, 0700, TRUE); - } - chmod($this->directory, 0700); -- file_save_htaccess($this->directory); -+ $htaccess_path = $this->directory . '/.htaccess'; -+ if (!file_exists($htaccess_path) && file_put_contents($htaccess_path, self::HTACCESS)) { -+ @chmod($htaccess_path, 0444); -+ } - } - +@@ -155,14 +159,14 @@ protected function ensureDirectory() { /** * Removes everything in a directory, leaving it empty. * @@ -153,7 +145,7 @@ index 68a6205..4d564fb 100644 } } } -@@ -180,8 +189,9 @@ protected function cleanDirectory($directory) { +@@ -185,8 +189,9 @@ protected function cleanDirectory($directory) { * @param int $directory_mtime * (optional) The mtime of $directory. Can be passed to avoid an extra * filesystem call when the mtime of the directory is already known. @@ -164,7 +156,7 @@ index 68a6205..4d564fb 100644 */ protected function getFullPath($name, &$directory = NULL, &$directory_mtime = NULL) { if (!isset($directory)) { -@@ -207,4 +217,5 @@ protected function getUncachedMTime($directory) { +@@ -212,4 +217,5 @@ protected function getUncachedMTime($directory) { clearstatcache(TRUE, $directory); return filemtime($directory); }