--- class.em_index.php 1 Aug 2006 12:04:25 -0000 1.1 +++ class.em_index.php 1 Aug 2006 16:39:23 -0000 @@ -322,7 +322,10 @@ var $listRemote; // If set, connects to remote repository var $lookUpStr; // Search string when listing local extensions - +//prs+ 01.08.2006 + var $excludeHidden=false; // if set, hidden or system files will not be transfered + var $pathAttribs=array(); // holds the attribs for a path to reduce exec calls +//prs- 01.08.2006 /********************************* @@ -2581,6 +2584,12 @@ + Exclude hidden files: + + + + +   @@ -3868,7 +3877,50 @@ $lines .= str_repeat(chr(9),$level-1).')'.($level-1==0 ? '':','.chr(10)); return $lines; } - +//prs+ 01.08.2006 + /** + * Removes hidden files from file array + * + * @param array Array of files + * @return array Array of files not hidden or system + */ + function _isHiddenWin($key='',$fName='',$extPath='') + { + /* + * On windows S and H attribute is set on index 3 or 4 + * + */ + $str=substr(exec('attrib '.$fName),0,6); + $isHidden=strpos($str,'S') || strpos($str,'H'); + $isHidden=($isHidden===false)?false:true; + if (!isset($this->pathAttribs[$key])) + { + $d=substr((exec('attrib '.dirname($fName))),0,6); + $this->pathAttribs[$key]=(strpos($d,'S') || strpos($d,'H')); + $this->pathAttribs[$key]=($this->pathAttribs[$key]===false)?false:true; + } + return ($isHidden || $this->pathAttribs[$key]); + } + function _isHiddenNix($key='',$fName='',$extPath='') + { + $cName=substr($fName,strlen($extPath)-1); + $pos=strpos($fName,'/.'); + return ($pos===false)?false:true; + } + function removeHiddenFiles($fileArr=array(),$extPath='') + { + $fA=array(); + $func=(TYPO3_OS=='WIN')?'_isHiddenWin':'_isHiddenNix'; + foreach($fileArr as $key=>$fName) + { + if (! $this->$func($key,$fName,$extPath)) + { + $fA[$key]=$fName; + } + } + return $fA; + } +//prs- 01.08.2006 /** * Make upload array out of extension * @@ -3885,6 +3937,14 @@ $fileArr = array(); $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr,$extPath); +//prs+ 01.08.2006 + if ($this->excludeHidden) + { + //remove hidden or system files from fileArr; + $fileArr=$this->removeHiddenFiles($fileArr,$extPath); + } +//prs- 01.08.2006 + // Calculate the total size of those files: $totalSize = 0; foreach($fileArr as $file) { @@ -4818,6 +4878,9 @@ */ function uploadExtensionToTER($em) { $msg = ''; + //prs+ 01.08.2006 + $this->excludeHidden=isset($em['upload']['exclude'])&& $em['upload']['exclude']; + //prs- 01.08.2006 $response = $this->terConnection->uploadToTER($em); if(!is_array($response)) return $response;