/**
  * Make upload array out of extension
  *
  * @param	string		Extension key
  * @param	array		Extension information array
  * @return	mixed		Returns array with extension upload array on success, otherwise an error string.
  */
 function makeUploadarray($extKey, $conf)
 {
     $extPath = tx_em_Tools::getExtPath($extKey, $conf['type']);
     if ($extPath) {
         // Get files for extension:
         $fileArr = array();
         $fileArr = t3lib_div::getAllFilesAndFoldersInPath($fileArr, $extPath, '', 0, 99, $GLOBALS['TYPO3_CONF_VARS']['EXT']['excludeForPackaging']);
         // Calculate the total size of those files:
         $totalSize = 0;
         foreach ($fileArr as $file) {
             $totalSize += filesize($file);
         }
         // If the total size is less than the upper limit, proceed:
         if ($totalSize < $this->maxUploadSize) {
             // Initialize output array:
             $uploadArray = array();
             $uploadArray['extKey'] = $extKey;
             $uploadArray['EM_CONF'] = $conf['EM_CONF'];
             $uploadArray['misc']['codelines'] = 0;
             $uploadArray['misc']['codebytes'] = 0;
             $uploadArray['techInfo'] = $this->install->makeDetailedExtensionAnalysis($extKey, $conf, 1);
             // Read all files:
             foreach ($fileArr as $file) {
                 $relFileName = substr($file, strlen($extPath));
                 $fI = pathinfo($relFileName);
                 if ($relFileName != 'ext_emconf.php') {
                     // This file should be dynamically written...
                     $uploadArray['FILES'][$relFileName] = array('name' => $relFileName, 'size' => filesize($file), 'mtime' => filemtime($file), 'is_executable' => TYPO3_OS == 'WIN' ? 0 : is_executable($file), 'content' => t3lib_div::getUrl($file));
                     if (t3lib_div::inList('php,inc', strtolower($fI['extension']))) {
                         $uploadArray['FILES'][$relFileName]['codelines'] = count(explode(LF, $uploadArray['FILES'][$relFileName]['content']));
                         $uploadArray['misc']['codelines'] += $uploadArray['FILES'][$relFileName]['codelines'];
                         $uploadArray['misc']['codebytes'] += $uploadArray['FILES'][$relFileName]['size'];
                         // locallang*.php files:
                         if (substr($fI['basename'], 0, 9) == 'locallang' && strstr($uploadArray['FILES'][$relFileName]['content'], '$LOCAL_LANG')) {
                             $uploadArray['FILES'][$relFileName]['LOCAL_LANG'] = tx_em_Tools::getSerializedLocalLang($file, $uploadArray['FILES'][$relFileName]['content']);
                         }
                     }
                     $uploadArray['FILES'][$relFileName]['content_md5'] = md5($uploadArray['FILES'][$relFileName]['content']);
                 }
             }
             // Return upload-array:
             return $uploadArray;
         } else {
             return sprintf($GLOBALS['LANG']->getLL('makeUploadArray_error_size'), $totalSize, t3lib_div::formatSize($this->maxUploadSize));
         }
     } else {
         return sprintf($GLOBALS['LANG']->getLL('makeUploadArray_error_path'), $extKey);
     }
 }