TYPO3 CMS  TYPO3_6-2
DownloadUtility.php
Go to the documentation of this file.
1 <?php
3 
22 
27  protected $terUtility;
28 
33  protected $repositoryHelper;
34 
38  protected $downloadPath = 'Local';
39 
45 
52  public function download(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) {
53  $mirrorUrl = $this->repositoryHelper->getMirrors()->getMirrorUrl();
54  $fetchedExtension = $this->terUtility->fetchExtension($extension->getExtensionKey(), $extension->getVersion(), $extension->getMd5hash(), $mirrorUrl);
55  if (isset($fetchedExtension['extKey']) && !empty($fetchedExtension['extKey']) && is_string($fetchedExtension['extKey'])) {
56  $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($fetchedExtension, $extension, $this->getDownloadPath());
57  }
58  }
59 
67  public function setDownloadPath($downloadPath) {
68  if (!in_array($downloadPath, \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallTypes())) {
69  throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(htmlspecialchars($downloadPath) . ' not in allowed download paths', 1344766387);
70  }
71  $this->downloadPath = $downloadPath;
72  }
73 
79  public function getDownloadPath() {
80  return $this->downloadPath;
81  }
82 
83 }
download(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)