Fixed bug #16134: TYPO3 doesn't always fix permissions for new files
authorTolleiv Nietsch <info@tolleiv.de>
Mon, 20 Dec 2010 19:42:03 +0000 (19:42 +0000)
committerTolleiv Nietsch <info@tolleiv.de>
Mon, 20 Dec 2010 19:42:03 +0000 (19:42 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-3@9863 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_div.php
t3lib/class.t3lib_iconworks.php
t3lib/class.t3lib_lock.php
t3lib/thumbs.php

index 8bce3a1..f970479 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-12-20  Tolleiv Nietsch  <typo3@tolleiv.de>
+
+       * Fixed bug #16134: TYPO3 doesn't always fix permissions for new files
+
 2010-12-17  Susanne Moog  <typo3@susanne-moog.de>
 
        * Fixed bug #5186: fixed rendering of multi-column image rows (thanks to Michael B├╝rgi)
index 186a482..5898d13 100644 (file)
@@ -439,11 +439,17 @@ final class t3lib_div {
                                exec($cmd);
 
                                $returnCode='IM';
+                               if (@is_file($theFile)) {
+                                       self::fixPermissions($theFile);
+                               }
                        } elseif (($type=='GD' || !$type) && $gfxConf['gdlib'] && !$gfxConf['gdlib_png'])       {       // GD
                                $tempImage = imageCreateFromGif($theFile);
                                imageGif($tempImage, $theFile);
                                imageDestroy($tempImage);
                                $returnCode='GD';
+                               if (@is_file($theFile)) {
+                                       self::fixPermissions($theFile);
+                               }
                        }
                }
                return $returnCode;
@@ -467,6 +473,9 @@ final class t3lib_div {
                                $cmd = self::imageMagickCommand('convert', '"'.$theFile.'" "'.$newFile.'"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw']);
                                exec($cmd);
                                $theFile = $newFile;
+                               if (@is_file($newFile)) {
+                                       self::fixPermissions($newFile);
+                               }
                                        // unlink old file?? May be bad idea bacause TYPO3 would then recreate the file every time as TYPO3 thinks the file is not generated because it's missing!! So do not unlink $theFile here!!
                }
                return $theFile;
@@ -493,7 +502,10 @@ final class t3lib_div {
                                $newFile = PATH_site.'typo3temp/readPG_'.md5($theFile.'|'.filemtime($theFile)).($output_png?'.png':'.gif');
                                $cmd = self::imageMagickCommand('convert', '"'.$theFile.'" "'.$newFile.'"', $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path']);
                                exec($cmd);
-                               if (@is_file($newFile)) return $newFile;
+                               if (@is_file($newFile)) {
+                                       self::fixPermissions($newFile);
+                                       return $newFile;
+                               }
                        }
                }
        }
@@ -5514,6 +5526,7 @@ final class t3lib_div {
                                        fwrite($file, date($dateFormat.' '.$timeFormat).$msgLine.chr(10));
                                        flock($file, LOCK_UN);    // release the lock
                                        fclose($file);
+                                       self::fixPermissions($destination);
                                }
                        }
                                // send message per mail
@@ -5585,6 +5598,7 @@ final class t3lib_div {
                        @fwrite($file, $date.$msg.chr(10));
                        flock($file, LOCK_UN);    // release the lock
                        @fclose($file);
+                       self::fixPermissions($destination);
                }
 
                // copy message also to the developer log
index 9c74873..8b33260 100644 (file)
@@ -542,6 +542,9 @@ final class t3lib_iconWorks {
                } else {
                        @ImageGif($im, $path);
                }
+               if (@is_file($path)) {
+                       t3lib_div::fixPermissions($path);
+               }
        }
 }
 ?>
index d7c957a..64de373 100644 (file)
@@ -169,6 +169,8 @@ class t3lib_lock {
                                if (($this->filepointer = touch($this->resource)) == FALSE) {
                                        throw new Exception('Lock file could not be created');
                                }
+
+                               t3lib_div::fixPermissions($this->resource);
                        break;
                        case 'flock':
                                if (($this->filepointer = fopen($this->resource, 'w+')) == FALSE) {
index cf1b5f0..149eb67 100644 (file)
@@ -232,6 +232,8 @@ class SC_t3lib_thumbs {
                                        exec($cmd);
                                        if (!file_exists($this->output))        {
                                                $this->errorGif('No thumb','generated!',basename($this->input));
+                                       } else {
+                                               t3lib_div::fixPermissions($this->output);
                                        }
                                }
                                        // The thumbnail is read and output to the browser