61 $files = array_diff_key($files, array_flip($directories));
74 $directories = array();
75 foreach ($files as $filePath => $file) {
76 preg_match(
'/(.*)\\//', $filePath, $matches);
77 if (!empty($matches[0])) {
78 $directories[] = $matches[0];
81 return array_unique($directories);
91 return $extensionData[
'FILES'];
103 foreach ($directories as $directory) {
117 }
catch(\RuntimeException $exception) {
134 foreach ($files as $file) {
150 if (is_dir($extDirPath)) {
168 $path = $paths[$pathType];
169 if (!$path || !is_dir($path) || !$extensionKey) {
173 return $path . $extensionKey .
'/';
185 if (!is_dir($extDirPath)) {
213 return is_dir($directory);
223 $requestedDirectories = array();
224 $requestUploadFolder = isset($extension[
'uploadfolder']) ? (boolean)$extension[
'uploadfolder'] : FALSE;
225 if ($requestUploadFolder) {
229 $requestCreateDirectories = empty($extension[
'createDirs']) ? FALSE : (string)$extension[
'createDirs'];
230 if ($requestCreateDirectories) {
236 return $requestedDirectories;
246 return 'uploads/tx_' . str_replace(
'_',
'', $extension[
'key']) .
'/';
258 $extensionPathWithoutTrailingSlash = rtrim($extDirPath,
'/');
259 if (is_link($extensionPathWithoutTrailingSlash) && TYPO3_OS !==
'WIN') {
260 $result = unlink($extensionPathWithoutTrailingSlash);
282 $emConfFileData = array();
283 if (file_exists($rootPath .
'ext_emconf.php')) {
284 $emConfFileData = $this->emConfUtility->includeEmConf(
286 'key' => $extensionData[
'extKey'],
291 $extensionData[
'EM_CONF'] = array_replace_recursive($emConfFileData, $extensionData[
'EM_CONF']);
292 $emConfContent = $this->emConfUtility->constructEmConf($extensionData, $extension);
304 foreach ($allowedPaths as $allowedPath) {
321 if (empty($absolutePath)) {
324 return $absolutePath;
344 $extension = $this->installUtility->enrichExtensionWithDetails($extension);
346 return $absolutePath;
356 $extensionData = $this->installUtility->enrichExtensionWithDetails($extension);
357 $version = $extensionData[
'version'];
375 if (empty($version)) {
379 $fileName = $this->
getAbsolutePath(
'typo3temp/' . $extension .
'_' . $version .
'_' . date(
'YmdHi') .
'.zip');
381 $zip = new \ZipArchive();
382 $zip->open($fileName, \ZipArchive::CREATE);
384 $excludePattern =
$GLOBALS[
'TYPO3_CONF_VARS'][
'EXT'][
'excludeForPackaging'];
400 $files = array_filter($files);
402 foreach ($files as $file) {
403 $fullPath = $extensionPath . $file;
406 if (is_dir($fullPath)) {
407 $zip->addEmptyDir($file);
409 $zip->addFile($fullPath, $file);
428 $zip = zip_open($file);
429 if (is_resource($zip)) {
430 while (($zipEntry = zip_read($zip)) !== FALSE) {
431 if (strpos(zip_entry_name($zipEntry),
'/') !== FALSE) {
432 $last = strrpos(zip_entry_name($zipEntry),
'/');
433 $dir = substr(zip_entry_name($zipEntry), 0, $last);
434 $file = substr(zip_entry_name($zipEntry), strrpos(zip_entry_name($zipEntry),
'/') + 1);
435 if (!is_dir($extensionDir . $dir)) {
438 if (strlen(trim($file)) > 0) {
439 $return =
GeneralUtility::writeFile($extensionDir . $dir .
'/' . $file, zip_entry_read($zipEntry, zip_entry_filesize($zipEntry)));
440 if ($return === FALSE) {
445 GeneralUtility::writeFile($extensionDir . zip_entry_name($zipEntry), zip_entry_read($zipEntry, zip_entry_filesize($zipEntry)));
461 if ($downloadName ===
'') {
462 $downloadName = basename($fileName,
'.zip');
464 header(
'Content-Type: application/zip');
465 header(
'Content-Length: ' . filesize($fileName));
466 header(
'Content-Disposition: attachment; filename="' . $downloadName .
'.zip"');
480 if ($downloadName ===
'') {
481 $downloadName = basename($fileName,
'.sql');
483 $downloadName = basename($downloadName,
'.sql');
485 header(
'Content-Type: text');
486 header(
'Content-Length: ' . filesize($fileName));
487 header(
'Content-Disposition: attachment; filename="' . $downloadName .
'.sql"');
extractDirectoriesFromExtensionData(array $files)
addDirectory($extDirPath)
createNestedDirectory($directory)
static mkdir_deep($directory, $deepDirectory='')
static getAllFilesAndFoldersInPath(array $fileArr, $path, $extList='', $regDirs=FALSE, $recursivityLevels=99, $excludePattern='')
getAbsolutePathsToConfiguredDirectories(array $extension)
static writeFile($file, $content, $changePermissions=FALSE)
getAbsolutePath($relativePath)
createDirectoriesForExtensionFiles(array $directories, $rootPath)
writeEmConfToFile(array $extensionData, $rootPath, Extension $extension=NULL)
static isFirstPartOfStr($str, $partStr)
unpackExtensionFromExtensionDataArray(array $extensionData, Extension $extension=NULL, $pathType='Local')
makeAndClearExtensionDir($extensionKey, $pathType='Local')
getPathToUploadFolder($extension)
static rmdir($path, $removeNonEmpty=FALSE)
extractFilesArrayFromExtensionData(array $extensionData)
unzipExtensionFromFile($file, $fileName, $pathType='Local')
writeExtensionFiles(array $files, $rootPath)
getAbsoluteExtensionPath($extension)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
static returnInstallPaths()
isValidExtensionPath($path)
ensureConfiguredDirectoriesExist(array $extension)
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
static fixWindowsFilePath($theFile)
static returnAllowedInstallPaths()
createZipFileFromExtension($extension)
directoryExists($directory)
getExtensionVersion($extension)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
sendZipFileToBrowserAndDelete($fileName, $downloadName='')
sendSqlDumpFileToBrowserAndDelete($fileName, $downloadName='')
static getFileAbsFileName($filename, $onlyRelative=TRUE, $relToTYPO3_mainDir=FALSE)
static removePrefixPathFromList(array $fileArr, $prefixToRemove)
static stripPathSitePrefix($path)
getRelativePath($absolutePath)
static resolveBackPath($pathStr)
getExtensionDir($extensionKey, $pathType='Local')
removeDirectory($extDirPath)
static sanitizeTrailingSeparator($path, $separator='/')