‪TYPO3CMS  10.4
DownloadUtility.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
23 
29 {
33  protected ‪$terUtility;
34 
38  protected ‪$repositoryHelper;
39 
43  protected ‪$downloadPath = 'Local';
44 
48  protected ‪$fileHandlingUtility;
49 
54  {
55  $this->terUtility = ‪$terUtility;
56  }
57 
62  {
63  $this->repositoryHelper = ‪$repositoryHelper;
64  }
65 
70  {
71  $this->fileHandlingUtility = ‪$fileHandlingUtility;
72  }
73 
79  public function ‪download(‪Extension $extension)
80  {
81  $mirrorUrl = $this->repositoryHelper->getMirrors()->getMirrorUrl();
82  $fetchedExtension = $this->terUtility->fetchExtension($extension->‪getExtensionKey(), $extension->‪getVersion(), $extension->‪getMd5hash(), $mirrorUrl);
83  if (isset($fetchedExtension['extKey']) && !empty($fetchedExtension['extKey']) && is_string($fetchedExtension['extKey'])) {
84  $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($fetchedExtension, $extension, $this->‪getDownloadPath());
85  }
86  }
87 
94  public function ‪setDownloadPath(‪$downloadPath)
95  {
97  throw new ExtensionManagerException(‪$downloadPath . ' not in allowed download paths', 1344766387);
98  }
99  $this->downloadPath = ‪$downloadPath;
100  }
101 
107  public function ‪getDownloadPath()
108  {
109  return ‪$this->downloadPath;
110  }
111 }
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\setDownloadPath
‪setDownloadPath($downloadPath)
Definition: DownloadUtility.php:90
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\$repositoryHelper
‪Helper $repositoryHelper
Definition: DownloadUtility.php:36
‪TYPO3\CMS\Extensionmanager\Utility
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension
Definition: Extension.php:29
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\getDownloadPath
‪string getDownloadPath()
Definition: DownloadUtility.php:103
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\injectFileHandlingUtility
‪injectFileHandlingUtility(FileHandlingUtility $fileHandlingUtility)
Definition: DownloadUtility.php:65
‪TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility
Definition: TerUtility.php:30
‪TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility
Definition: FileHandlingUtility.php:35
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension\getMd5hash
‪string getMd5hash()
Definition: Extension.php:431
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\$terUtility
‪TerUtility $terUtility
Definition: DownloadUtility.php:32
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension\getVersion
‪string getVersion()
Definition: Extension.php:399
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension\getExtensionKey
‪string getExtensionKey()
Definition: Extension.php:270
‪TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
Definition: ExtensionManagerException.php:24
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility
Definition: DownloadUtility.php:29
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:23
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\$fileHandlingUtility
‪FileHandlingUtility $fileHandlingUtility
Definition: DownloadUtility.php:44
‪TYPO3\CMS\Extensionmanager\Utility\Repository\Helper
Definition: Helper.php:37
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\injectRepositoryHelper
‪injectRepositoryHelper(Helper $repositoryHelper)
Definition: DownloadUtility.php:57
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\injectTerUtility
‪injectTerUtility(TerUtility $terUtility)
Definition: DownloadUtility.php:49
‪TYPO3\CMS\Extensionmanager\Domain\Model\Extension\returnAllowedInstallTypes
‪static array returnAllowedInstallTypes()
Definition: Extension.php:476
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\download
‪download(Extension $extension)
Definition: DownloadUtility.php:75
‪TYPO3\CMS\Extensionmanager\Utility\DownloadUtility\$downloadPath
‪string $downloadPath
Definition: DownloadUtility.php:40