Fixing issues where permissions would not be set to world writable on file caches.

This commit is contained in:
mark_story 2010-07-01 18:18:12 -04:00
parent 9e3a41e013
commit 62e16c7058

View file

@ -76,9 +76,12 @@ class FileEngine extends CacheEngine {
$settings $settings
)); ));
if (DIRECTORY_SEPARATOR === '\\') { if (DS === '\\') {
$this->settings['isWindows'] = true; $this->settings['isWindows'] = true;
} }
if (substr($this->settings['path'], -1) !== DS) {
$this->settings['path'] .= DS;
}
return $this->_active(); return $this->_active();
} }
@ -266,15 +269,16 @@ class FileEngine extends CacheEngine {
* @access protected * @access protected
*/ */
protected function _setKey($key, $createKey = false) { protected function _setKey($key, $createKey = false) {
$path = new SplFileInfo($this->settings['path'] . DS . $key); $path = new SplFileInfo($this->settings['path'] . $key);
if (!$createKey && !$path->isFile()) { if (!$createKey && !$path->isFile()) {
return false; return false;
} }
$old = umask(0);
if (empty($this->_File) || $this->_File->getBaseName() !== $key) { if (empty($this->_File) || $this->_File->getBaseName() !== $key) {
$this->_File = $path->openFile('a+'); $this->_File = $path->openFile('a+');
} }
umask($old);
return true; return true;
} }