Project

General

Profile

Bug #14154 » 0000076-patch_writeFile.diff

Administrator Admin, 2004-05-11 22:08

View differences:

class.t3lib_div.php.patched Tue May 11 21:38:09 2004
* @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;
(1-1/2)