Index: documentation/manual/en/module_specs/Zend_Cache-Backends.xml
===================================================================
--- documentation/manual/en/module_specs/Zend_Cache-Backends.xml (revision 24675)
+++ documentation/manual/en/module_specs/Zend_Cache-Backends.xml (working copy)
@@ -92,10 +92,10 @@
- hashed_directory_umask
+ hashed_directory_perm
Integer
0700
- Umask for the hashed directory structure
+ Permissins for the hashed directory structure
@@ -117,6 +117,13 @@
0600
umask for cache files
+
+
+ cache_file_perm
+ Integer
+ 0600
+ Permissions for cache files
+
metatadatas_array_max_size
Index: tests/Zend/Cache/FileBackendTest.php
===================================================================
--- tests/Zend/Cache/FileBackendTest.php (revision 24675)
+++ tests/Zend/Cache/FileBackendTest.php (working copy)
@@ -76,6 +76,40 @@
unset($this->_instance);
}
+ public function testSetDeprecatedHashedDirectoryUmask()
+ {
+ try {
+ $cache = new Zend_Cache_Backend_File(array(
+ 'cache_dir' => $this->_cache_dir,
+ 'hashed_directory_umask' => 0700,
+ ));
+ $this->fail("Missing expected E_USER_DEPRECATED error");
+ } catch (PHPUnit_Framework_Error $e) {
+ if ($e->getCode() != E_USER_DEPRECATED) {
+ throw $e;
+ }
+
+ $this->assertContains('hashed_directory_umask', $e->getMessage());
+ }
+ }
+
+ public function testSetDeprecatedCacheFileUmask()
+ {
+ try {
+ $cache = new Zend_Cache_Backend_File(array(
+ 'cache_dir' => $this->_cache_dir,
+ 'cache_file_umask' => 0700,
+ ));
+ $this->fail("Missing expected E_USER_DEPRECATED error");
+ } catch (PHPUnit_Framework_Error $e) {
+ if ($e->getCode() != E_USER_DEPRECATED) {
+ throw $e;
+ }
+
+ $this->assertContains('cache_file_umask', $e->getMessage());
+ }
+ }
+
public function testConstructorCorrectCall()
{
$test = new Zend_Cache_Backend_File(array());
@@ -122,5 +156,3 @@
}
}
-
-
Index: library/Zend/Cache/Backend/File.php
===================================================================
--- library/Zend/Cache/Backend/File.php (revision 24675)
+++ library/Zend/Cache/Backend/File.php (working copy)
@@ -71,7 +71,11 @@
* for you. Maybe, 1 or 2 is a good start.
*
* =====> (int) hashed_directory_umask :
- * - Umask for hashed directory structure
+ * - deprecated
+ * - Permissions for hashed directory structure
+ *
+ * =====> (int) hashed_directory_perm :
+ * - Permissions for hashed directory structure
*
* =====> (string) file_name_prefix :
* - prefix for cache files
@@ -79,7 +83,11 @@
* (like /tmp) can cause disasters when cleaning the cache
*
* =====> (int) cache_file_umask :
- * - Umask for cache files
+ * - deprecated
+ * - Permissions for cache files
+ *
+ * =====> (int) cache_file_perm :
+ * - Permissions for cache files
*
* =====> (int) metatadatas_array_max_size :
* - max size for the metadatas array (don't change this value unless you
@@ -93,9 +101,9 @@
'read_control' => true,
'read_control_type' => 'crc32',
'hashed_directory_level' => 0,
- 'hashed_directory_umask' => 0700,
+ 'hashed_directory_perm' => 0700,
'file_name_prefix' => 'zend_cache',
- 'cache_file_umask' => 0600,
+ 'cache_file_perm' => 0600,
'metadatas_array_max_size' => 100
);
@@ -130,13 +138,29 @@
if ($this->_options['metadatas_array_max_size'] < 10) {
Zend_Cache::throwException('Invalid metadatas_array_max_size, must be > 10');
}
- if (isset($options['hashed_directory_umask']) && is_string($options['hashed_directory_umask'])) {
+
+ if (isset($options['hashed_directory_umask'])) {
+ // See #ZF-12047
+ trigger_error("'hashed_directory_umask' has been deprecated -> please use 'hashed_directory_perm' instead", E_USER_DEPRECATED);
+ if (!isset($options['hashed_directory_perm'])) {
+ $options['hashed_directory_perm'] = $options['hashed_directory_umask'];
+ }
+ }
+ if (isset($options['hashed_directory_perm']) && is_string($options['hashed_directory_perm'])) {
// See #ZF-4422
- $this->_options['hashed_directory_umask'] = octdec($this->_options['hashed_directory_umask']);
+ $this->_options['hashed_directory_perm'] = octdec($this->_options['hashed_directory_perm']);
+ }
+
+ if (isset($options['cache_file_umask'])) {
+ // See #ZF-12047
+ trigger_error("'cache_file_umask' has been deprecated -> please use 'cache_file_perm' instead", E_USER_DEPRECATED);
+ if (!isset($options['cache_file_perm'])) {
+ $options['cache_file_perm'] = $options['cache_file_umask'];
+ }
}
- if (isset($options['cache_file_umask']) && is_string($options['cache_file_umask'])) {
+ if (isset($options['cache_file_perm']) && is_string($options['cache_file_perm'])) {
// See #ZF-4422
- $this->_options['cache_file_umask'] = octdec($this->_options['cache_file_umask']);
+ $this->_options['cache_file_perm'] = octdec($this->_options['cache_file_perm']);
}
}
@@ -919,8 +943,8 @@
$partsArray = $this->_path($id, true);
foreach ($partsArray as $part) {
if (!is_dir($part)) {
- @mkdir($part, $this->_options['hashed_directory_umask']);
- @chmod($part, $this->_options['hashed_directory_umask']); // see #ZF-320 (this line is required in some configurations)
+ @mkdir($part, $this->_options['hashed_directory_perm']);
+ @chmod($part, $this->_options['hashed_directory_perm']); // see #ZF-320 (this line is required in some configurations)
}
}
return true;
@@ -988,7 +1012,7 @@
}
@fclose($f);
}
- @chmod($file, $this->_options['cache_file_umask']);
+ @chmod($file, $this->_options['cache_file_perm']);
return $result;
}