Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 7372) +++ t3lib/class.t3lib_div.php (working copy) @@ -2961,21 +2961,38 @@ } /** - * Sets the file system mode and group ownership of file. + * Sets the file system mode and group ownership of a file or a folder. * - * @param string $file - * the path of an existing file, must not be escaped - * - * @return void + * @param string Filepath of file or folder, must not be escaped + * @param boolean If set, also fixes permissions of files and folders in the folder (if $path is a folder) + * @return void */ - public static function fixPermissions($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 - if($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) { // skip this if createGroup is empty - @chgrp($file, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']); // "@" is there because file is not necessarily OWNED by the user + public static function fixPermissions($path, $recursively = FALSE) { + + if (TYPO3_OS != 'WIN') { + if ($recursively === FALSE) { + // regex filters '.' and '..' + $directoryListing = new RegexIterator(new IteratorIterator(new DirectoryIterator($path)), '/[^.]+/', RegexIterator::MATCH); + } else { + $directoryListing = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); } + + $folderCreateMask = octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask']); + $fileCreateMask = octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask']); + foreach($directoryListing as $directoryItem) { + if ($directoryItem->isDir()) { + @chmod($directoryItem, $folderCreateMask); // "@" is there because file is not necessarily OWNED by the user + } else { + @chmod($directoryItem, $fileCreateMask); // "@" is there because file is not necessarily OWNED by the user + } + + if($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) { // skip this if createGroup is empty + @chgrp($path, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']); // "@" is there because file is not necessarily OWNED by the user + } + } } } + /** * Writes $content to a filename in the typo3temp/ folder (and possibly one or two subfolders...) @@ -3028,18 +3045,13 @@ * @param string Absolute path to folder, see PHP mkdir() function. Removes trailing slash internally. * @return boolean TRUE if @mkdir went well! */ - public static function mkdir($theNewFolder) { - $theNewFolder = preg_replace('|/$|','',$theNewFolder); - if (@mkdir($theNewFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask']))){ - chmod($theNewFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'])); //added this line, because the mode at 'mkdir' has a strange behaviour sometimes - - if($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']) { // skip this if createGroup is empty - @chgrp($theNewFolder, $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup']); - } - return true; - } else { - return false; + public static function mkdir($newFolder) { + $newFolder = preg_replace('|/$|','',$newFolder); + $success = @mkdir($newFolder, octdec($GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'])); + if ($success) { + self::fixPermissions($newFolder); } + return $success; } /** Index: typo3/mod/tools/em/class.em_index.php =================================================================== --- typo3/mod/tools/em/class.em_index.php (revision 7372) +++ typo3/mod/tools/em/class.em_index.php (working copy) @@ -1498,6 +1498,8 @@ $GLOBALS['LANG']->getLL('translation_update_done') . '"; '; + // Fix permissions on unzipped language xml files in the entire l10n folder and all subfolders... + t3lib_div::fixPermissions(PATH_typo3conf . 'l10n/', TRUE); echo $contentParts[1] . $this->doc->endPage(); exit; } @@ -1521,7 +1523,7 @@ $path = 'l10n/'.$lang.'/'; if(!is_dir(PATH_typo3conf.$path)) t3lib_div::mkdir_deep(PATH_typo3conf,$path); t3lib_div::writeFile($file, $l10n[0]); - if($this->unzip($file, PATH_typo3conf.$path)) { + if($this->unzip($file, PATH_typo3conf . $path)) { return true; } else { return $GLOBALS['LANG']->getLL('translation_unpacking_failed'); @@ -1541,11 +1543,11 @@ function installTranslationsForExtension($extKey, $mirrorURL) { $selectedLanguages = unserialize($this->MOD_SETTINGS['selectedLanguages']); if(!is_array($selectedLanguages)) $selectedLanguages = array(); - foreach($selectedLanguages as $lang) { + foreach ($selectedLanguages as $lang) { $l10n = $this->terConnection->fetchTranslation($extKey, $lang, $mirrorURL); if(is_array($l10n)) { - $file = PATH_typo3conf.'l10n/'.$extKey.'-l10n-'.$lang.'.zip'; - $path = 'l10n/'.$lang.'/'.$extKey; + $file = PATH_typo3conf . 'l10n/' . $extKey . '-l10n-' . $lang . '.zip'; + $path = 'l10n/' . $lang . '/' . $extKey; t3lib_div::writeFile($file, $l10n[0]); if(!is_dir(PATH_typo3conf.$path)) t3lib_div::mkdir_deep(PATH_typo3conf,$path); if($this->unzip($file, PATH_typo3conf.$path)) {