2 namespace TYPO3\CMS\Composer\Installer;
74 $this->downloadManager = $composer->getDownloadManager();
92 $webDir = $this->filesystem->normalizePath($this->pluginConfig->get(
'web-dir'));
93 $this->filesystem->ensureDirectoryExists($webDir);
94 $backendDir = $this->filesystem->normalizePath($this->pluginConfig->get(
'backend-dir'));
96 $this->symlinks = array(
97 $sourcesDir . DIRECTORY_SEPARATOR . self::TYPO3_INDEX_PHP
98 => $webDir . DIRECTORY_SEPARATOR . self::TYPO3_INDEX_PHP,
99 $sourcesDir . DIRECTORY_SEPARATOR . self::TYPO3_DIR
111 return $packageType ===
'typo3-cms-core';
122 public function isInstalled(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package) {
123 return $repo->hasPackage($package)
125 && $this->filesystem->allFilesExist($this->symlinks);
134 public function install(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package) {
135 $this->getTypo3OrgService->addDistToPackage($package);
137 if ($this->filesystem->someFilesExist($this->symlinks)) {
138 $this->filesystem->removeSymlinks($this->symlinks);
143 $this->filesystem->establishSymlinks($this->symlinks, FALSE);
145 if (!$repo->hasPackage($package)) {
146 $repo->addPackage(clone $package);
157 public function update(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $initial, \Composer\Package\PackageInterface $target) {
158 $this->getTypo3OrgService->addDistToPackage($initial);
159 $this->getTypo3OrgService->addDistToPackage($target);
161 if ($this->filesystem->someFilesExist($this->symlinks)) {
162 $this->filesystem->removeSymlinks($this->symlinks);
167 $this->filesystem->establishSymlinks($this->symlinks, FALSE);
169 $repo->removePackage($initial);
170 if (!$repo->hasPackage($target)) {
171 $repo->addPackage(clone $target);
181 public function uninstall(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package) {
182 if (!$repo->hasPackage($package)) {
183 throw new \InvalidArgumentException(
'Package is not installed: '.$package);
186 if ($this->filesystem->someFilesExist($this->symlinks)) {
187 $this->filesystem->removeSymlinks($this->symlinks);
191 $repo->removePackage($package);
208 return $this->pluginConfig->get(
'cms-package-dir');
214 protected function installCode(\Composer\Package\PackageInterface $package) {
216 $this->downloadManager->download($package, $downloadPath);
223 protected function updateCode(\Composer\Package\PackageInterface $initial, \Composer\Package\PackageInterface $target) {
228 if ($targetDownloadPath !== $initialDownloadPath) {
231 if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
232 || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
240 $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
242 $this->downloadManager->update($initial, $target, $targetDownloadPath);
248 protected function removeCode(\Composer\Package\PackageInterface $package) {
250 $this->downloadManager->remove($package, $downloadPath);