Skip to content

Commit

Permalink
Fix permissions on static JS/CSS files
Browse files Browse the repository at this point in the history
tempfiles are created as mode 0600.  Still want to use getTempFile()
though, since it handles cleanup for us in case of error.
  • Loading branch information
slusarz committed Nov 5, 2014
1 parent 89a6e36 commit fa9574c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions framework/Core/lib/Horde/Script/Cache/File.php
Expand Up @@ -135,6 +135,7 @@ protected function _process($scripts)

$temp = Horde_Util::getTempFile('staticjs', true, $js_fs);
if (!file_put_contents($temp, $jsmin->minify(), LOCK_EX) ||
!chmod($temp, 0777 & ~umask()) ||
!rename($temp, $js_path)) {
Horde::log('Could not write cached JS file to disk.', Horde_Log::EMERG);
} elseif ($this->_compress->sourcemap_support) {
Expand Down
1 change: 1 addition & 0 deletions framework/Core/lib/Horde/Themes/Css/Cache/File.php
Expand Up @@ -50,6 +50,7 @@ public function process($css, $cacheid)
$compress = new Horde_Themes_Css_Compress();
$temp = Horde_Util::getTempFile('staticcss', true, $js_fs);
if (!file_put_contents($temp, $compress->compress($css), LOCK_EX) ||
!chmod($temp, 0777 & ~umask()) ||
!rename($temp, $path)) {
Horde::log('Could not write cached CSS file to disk.', 'EMERG');
return array();
Expand Down

0 comments on commit fa9574c

Please sign in to comment.