--- class.t3lib_div.php Tue May 11 21:21:10 2004 +++ class.t3lib_div.php.patched Tue May 11 21:38:09 2004 @@ -2009,13 +2009,19 @@ * @return boolean True if the file was successfully opened and written to. */ function writeFile($file,$content) { + // If file already exists before writing, get its permissions + if (@is_file($file)) { + $perms = octdec(substr(sprintf("%o",fileperms($file)),2)); + } else { + $perms = octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask']); + } if($fd = fopen($file,'wb')) { fwrite( $fd, $content); fclose( $fd ); // Setting file system mode of file: if (@is_file($file) && TYPO3_OS!='WIN') { - @chmod($file, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'])); // "@" is there because file is not necessarily OWNED by the user + @chmod($file, $perms); // "@" is there because file is not necessarily OWNED by the user } return true;