/** * @test * @return void * @expectedException \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException * @expectedExceptionCode 1342432101 */ public function addExtensionToQueueThrowsExceptionIfExtensionWithSameKeyAndDifferentValuesAlreadyExists() { /** @var \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extensionMock2 */ $extensionMock2 = $this->getMock(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension::class, array('dummy')); $extensionMock2->setExtensionKey('foobar'); $extensionMock2->setVersion('1.0.3'); $this->downloadQueueMock->addExtensionToQueue($extensionMock2); $this->downloadQueueMock->addExtensionToQueue($this->extensionMock); }
/** * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension|array $extension * @return array */ public function resolveDependenciesAndInstall($extension) { if (!is_array($extension) && !$extension instanceof \TYPO3\CMS\Extensionmanager\Domain\Model\Extension) { throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException('Extension must be array or object.', 1350891642); } $this->dependencyUtility->buildExtensionDependenciesTree($extension); if ($extension instanceof \TYPO3\CMS\Extensionmanager\Domain\Model\Extension) { // We have a TER Extension, which should be downloaded first. $this->downloadQueue->addExtensionToQueue($extension); $extensionKey = $extension->getExtensionKey(); } else { $extensionKey = $extension['key']; } $queue = $this->downloadQueue->getExtensionQueue(); $downloadedDependencies = array(); $updatedDependencies = array(); $installedDependencies = array(); if (array_key_exists('download', $queue)) { $downloadedDependencies = $this->downloadDependencies($queue['download']); } if (array_key_exists('update', $queue)) { $this->downloadDependencies($queue['update']); $updatedDependencies = $this->uninstallDependenciesToBeUpdated($queue['update']); } // add extension at the end of the download queue $this->downloadQueue->addExtensionToInstallQueue($extensionKey); $installQueue = $this->downloadQueue->getExtensionInstallStorage(); if (count($installQueue) > 0) { $installedDependencies = $this->installDependencies($installQueue); } return array_merge($downloadedDependencies, $updatedDependencies, $installedDependencies); }
/** * @param Extension $extension * @return void */ public function markExtensionForUpdate(Extension $extension) { // We have to check for dependencies of the extension first, before marking it for download // because this extension might have dependencies, which need to be downloaded and installed first $this->dependencyUtility->checkDependencies($extension); $this->downloadQueue->addExtensionToQueue($extension, 'update'); }
/** * @param \TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension * @return array */ public function resolveDependenciesAndInstall(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) { $this->dependencyUtility->buildExtensionDependenciesTree($extension); $this->downloadQueue->addExtensionToQueue($extension); $queue = $this->downloadQueue->getExtensionQueue(); $downloadedDependencies = array(); $updatedDependencies = array(); $installedDependencies = array(); if (array_key_exists('download', $queue)) { $downloadedDependencies = $this->downloadDependencies($queue['download']); } if (array_key_exists('update', $queue)) { $this->downloadDependencies($queue['update']); $updatedDependencies = $this->uninstallDependenciesToBeUpdated($queue['update']); } // add extension at the end of the download queue $this->downloadQueue->addExtensionToInstallQueue($extension->getExtensionKey()); $installQueue = $this->downloadQueue->getExtensionInstallStorage(); if (count($installQueue) > 0) { $installedDependencies = $this->installDependencies($installQueue); } return array_merge($downloadedDependencies, $updatedDependencies, $installedDependencies); }