/**
     * Renders a download link
     *
     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
     * @return string the rendered a tag
     */
    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
    {
        $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
        if (empty($installPaths)) {
            return '';
        }
        $pathSelector = '<ul class="is-hidden">';
        foreach ($installPaths as $installPathType => $installPath) {
            $pathSelector .= '<li>
				<input type="radio" id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '" name="' . htmlspecialchars($this->getFieldNamePrefix('downloadPath')) . '[downloadPath]" class="downloadPath" value="' . htmlspecialchars($installPathType) . '"' . ($installPathType == 'Local' ? ' checked="checked"' : '') . '/>
				<label for="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadPath-' . htmlspecialchars($installPathType) . '">' . htmlspecialchars($installPathType) . '</label>
			</li>';
        }
        $pathSelector .= '</ul>';
        $uriBuilder = $this->controllerContext->getUriBuilder();
        $action = 'checkDependencies';
        $uriBuilder->reset();
        $uriBuilder->setFormat('json');
        $uri = $uriBuilder->uriFor($action, array('extension' => (int) $extension->getUid()), 'Download');
        $this->tag->addAttribute('data-href', $uri);
        $label = '
			<div class="btn-group">
				<button
					title="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '"
					type="submit"
					class="btn btn-default"
					value="' . LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '"
				>
					<span class="t3-icon fa fa-cloud-download"></span>
				</button>
			</div>';
        $this->tag->setContent($label . $pathSelector);
        $this->tag->addAttribute('class', 'download');
        return '<div id="' . htmlspecialchars($extension->getExtensionKey()) . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
    }
Ejemplo n.º 2
0
 /**
  * Download an extension
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @return void
  */
 public function download(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
 {
     $mirrorUrl = $this->repositoryHelper->getMirrors()->getMirrorUrl();
     $fetchedExtension = $this->terUtility->fetchExtension($extension->getExtensionKey(), $extension->getVersion(), $extension->getMd5hash(), $mirrorUrl);
     if (isset($fetchedExtension['extKey']) && !empty($fetchedExtension['extKey']) && is_string($fetchedExtension['extKey'])) {
         $this->fileHandlingUtility->unpackExtensionFromExtensionDataArray($fetchedExtension, $extension, $this->getDownloadPath());
     }
 }
 /**
  * Renders an install link
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @return string the rendered a tag
  */
 public function render($extension)
 {
     $uriBuilder = $this->controllerContext->getUriBuilder();
     $action = 'showAllVersions';
     $uri = $uriBuilder->reset()->uriFor($action, array('extensionKey' => $extension->getExtensionKey(), 'allVersions' => TRUE), 'List');
     $this->tag->addAttribute('href', $uri);
     $label = 'Show all versions';
     $this->tag->setContent($label);
     return $this->tag->render();
 }
 /**
  * Renders an install link
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @return string the rendered a tag
  */
 public function render($extension)
 {
     $uriBuilder = $this->controllerContext->getUriBuilder();
     $action = 'showAllVersions';
     $uri = $uriBuilder->reset()->uriFor($action, array('extensionKey' => $extension->getExtensionKey()), 'List');
     $this->tag->addAttribute('href', $uri);
     // Set class
     $this->tag->addAttribute('class', 'versions-all ui-icon ui-icon-triangle-1-s');
     $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.showAllVersions.label', 'extensionmanager');
     $this->tag->setContent($label);
     return $this->tag->render();
 }
    /**
     * Renders a download link
     *
     * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
     * @return string the rendered a tag
     */
    public function render(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
    {
        $installPaths = \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallPaths();
        $pathSelector = '<ul>';
        foreach ($installPaths as $installPathType => $installPath) {
            $pathSelector .= '<li>
				<input type="radio" id="' . $extension->getExtensionKey() . '-downloadPath-' . $installPathType . '" name="' . $this->getFieldNamePrefix('downloadPath') . '[downloadPath]" class="downloadPath" value="' . $installPathType . '"' . ($installPathType == 'Local' ? 'checked="checked"' : '') . '/>
				<label for="' . $extension->getExtensionKey() . '-downloadPath-' . $installPathType . '">' . $installPathType . '</label>
			</li>';
        }
        $pathSelector .= '</ul>';
        $uriBuilder = $this->controllerContext->getUriBuilder();
        $action = 'checkDependencies';
        $uriBuilder->reset();
        $uriBuilder->setFormat('json');
        $uri = $uriBuilder->uriFor($action, array('extension' => $extension->getUid()), 'Download');
        $this->tag->addAttribute('href', $uri);
        $label = '<input type="submit" value="Import and Install" />';
        $this->tag->setContent($label . $pathSelector);
        $this->tag->addAttribute('class', 'download');
        return '<div id="' . $extension->getExtensionKey() . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
    }
Ejemplo n.º 6
0
 /**
  * Shows information about the distribution
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  */
 public function showAction(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
 {
     $extensionKey = $extension->getExtensionKey();
     // Check if extension/package is installed
     $active = $this->packageManager->isPackageActive($extensionKey);
     // Create link for extension configuration
     if ($active && file_exists(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($extensionKey) . 'ext_conf_template.txt')) {
         $uriBuilder = $this->controllerContext->getUriBuilder();
         $action = 'showConfigurationForm';
         $configurationLink = $uriBuilder->reset()->uriFor($action, array('extension' => array('key' => $extensionKey)), 'Configuration');
     } else {
         $configurationLink = FALSE;
     }
     $this->view->assign('distributionActive', $active);
     $this->view->assign('configurationLink', $configurationLink);
     $this->view->assign('extension', $extension);
 }
Ejemplo n.º 7
0
 /**
  * Returns the updateable version for an extension which also resolves dependencies.
  *
  * @internal
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionData
  * @return bool|\TYPO3\CMS\Extensionmanager\Domain\Model\Extension FALSE if no update available otherwise latest
  *                                                                 possible update
  */
 public function getUpdateableVersion(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionData)
 {
     // Only check for update for TER extensions
     $version = $extensionData->getIntegerVersion();
     /** @var $extensionUpdates[] \TYPO3\CMS\Extensionmanager\Domain\Model\Extension */
     $extensionUpdates = $this->extensionRepository->findByVersionRangeAndExtensionKeyOrderedByVersion($extensionData->getExtensionKey(), $version, 0, FALSE);
     if ($extensionUpdates->count() > 0) {
         foreach ($extensionUpdates as $extensionUpdate) {
             try {
                 $this->dependencyUtility->checkDependencies($extensionUpdate);
                 if (!$this->dependencyUtility->hasDependencyErrors()) {
                     return $extensionUpdate;
                 }
             } catch (ExtensionManagerException $e) {
             }
         }
     }
     return FALSE;
 }
Ejemplo n.º 8
0
 /**
  * Checks if an update for an extension is available
  *
  * @internal
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionData
  * @return boolean
  */
 public function isUpdateAvailable(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionData)
 {
     // Only check for update for TER extensions
     $version = $extensionData->getIntegerVersion();
     /** @var $highestTerVersionExtension \TYPO3\CMS\Extensionmanager\Domain\Model\Extension */
     $highestTerVersionExtension = $this->extensionRepository->findHighestAvailableVersion($extensionData->getExtensionKey());
     if ($highestTerVersionExtension instanceof \TYPO3\CMS\Extensionmanager\Domain\Model\Extension) {
         $highestVersion = $highestTerVersionExtension->getIntegerVersion();
         if ($highestVersion > $version) {
             return TRUE;
         }
     }
     return FALSE;
 }
Ejemplo n.º 9
0
 /**
  * Checks dependencies for special cases (currently typo3 and php)
  *
  * @param Extension $extension
  * @return void
  */
 public function checkDependencies(Extension $extension)
 {
     $this->dependencyErrors = [];
     $dependencies = $extension->getDependencies();
     foreach ($dependencies as $dependency) {
         /** @var Dependency $dependency */
         $identifier = strtolower($dependency->getIdentifier());
         try {
             if (in_array($identifier, Dependency::$specialDependencies)) {
                 if (!$this->skipDependencyCheck) {
                     $methodName = 'check' . ucfirst($identifier) . 'Dependency';
                     $this->{$methodName}($dependency);
                 }
             } else {
                 if ($dependency->getType() === 'depends') {
                     $this->checkExtensionDependency($dependency);
                 }
             }
         } catch (Exception\UnresolvedDependencyException $e) {
             if (in_array($identifier, Dependency::$specialDependencies)) {
                 $extensionKey = $extension->getExtensionKey();
             } else {
                 $extensionKey = $identifier;
             }
             if (!isset($this->dependencyErrors[$extensionKey])) {
                 $this->dependencyErrors[$extensionKey] = [];
             }
             $this->dependencyErrors[$extensionKey][] = ['code' => $e->getCode(), 'message' => $e->getMessage()];
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Checks if an update for an extension is available
  *
  * @internal
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionData
  * @return boolean
  */
 public function isUpdateAvailable(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionData)
 {
     $isUpdateAvailable = FALSE;
     // Only check for update for TER extensions
     $version = $extensionData->getIntegerVersion();
     /** @var $highestTerVersionExtension \TYPO3\CMS\Extensionmanager\Domain\Model\Extension */
     $highestTerVersionExtension = $this->extensionRepository->findHighestAvailableVersion($extensionData->getExtensionKey());
     if ($highestTerVersionExtension instanceof \TYPO3\CMS\Extensionmanager\Domain\Model\Extension) {
         $highestVersion = $highestTerVersionExtension->getIntegerVersion();
         if ($highestVersion > $version) {
             $this->dependencyUtility->checkDependencies($highestTerVersionExtension);
             if (!$this->dependencyUtility->hasDependencyErrors()) {
                 $isUpdateAvailable = TRUE;
             }
         }
     }
     return $isUpdateAvailable;
 }
Ejemplo n.º 11
0
 /**
  * Remove an extension from download queue
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @param string $stack Stack to remove extension from (download, update or install)
  * @throws \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
  * @return void
  */
 public function removeExtensionFromQueue(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension, $stack = 'download')
 {
     if (!is_string($stack) || !in_array($stack, ['download', 'update'])) {
         throw new ExtensionManagerException('Stack has to be either "download" or "update"', 1342432104);
     }
     if (array_key_exists($stack, $this->extensionStorage) && is_array($this->extensionStorage[$stack])) {
         if (array_key_exists($extension->getExtensionKey(), $this->extensionStorage[$stack])) {
             unset($this->extensionStorage[$stack][$extension->getExtensionKey()]);
         }
     }
 }
Ejemplo n.º 12
0
 /**
  * Adds an extension to the install queue for later installation
  *
  * @param Extension $extension
  * @return void
  */
 public function addExtensionToInstallQueue($extension)
 {
     $this->extensionInstallStorage[$extension->getExtensionKey()] = $extension;
 }
Ejemplo n.º 13
0
 /**
  * Prepares an extension for import from TER
  * Uninstalls the extension if it is already loaded (case: update)
  * and reloads the caches.
  *
  * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension
  * @return void
  */
 protected function prepareExtensionForImport(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension)
 {
     if (\TYPO3\CMS\Core\Extension\ExtensionManager::isLoaded($extension->getExtensionKey())) {
         \TYPO3\CMS\Core\Extension\ExtensionManager::unloadExtension($extension->getExtensionKey());
         $this->installUtility->reloadCaches();
     }
 }