TYPO3  7.6
cms-composer-installers/Classes/TYPO3/CMS/Composer/Installer/Plugin.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Composer\Installer;
3 
4 /***************************************************************
5  * Copyright notice
6  *
7  * (c) 2014 Christian Opitz <christian.opitz at netresearch.de>
8  * All rights reserved
9  *
10  * This script is part of the TYPO3 project. The TYPO3 project is
11  * free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * The GNU General Public License can be found at
17  * http://www.gnu.org/copyleft/gpl.html.
18  *
19  * This script is distributed in the hope that it will be useful,
20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU General Public License for more details.
23  *
24  * This copyright notice MUST APPEAR in all copies of the script!
25  ***************************************************************/
26 
27 use Composer\Composer;
28 use Composer\EventDispatcher\EventSubscriberInterface;
29 use Composer\IO\IOInterface;
30 use Composer\Plugin\PluginInterface;
31 use Composer\Cache;
32 use Composer\Script\ScriptEvents;
34 
41 class Plugin implements PluginInterface, EventSubscriberInterface {
42 
46  public static function getSubscribedEvents() {
47  return array(
48  ScriptEvents::POST_AUTOLOAD_DUMP => 'postAutoload'
49  );
50  }
51 
55  public function activate(Composer $composer, IOInterface $io) {
56  $filesystem = new Filesystem();
57  $composer
58  ->getInstallationManager()
59  ->addInstaller(
60  new CoreInstaller(
61  $composer,
62  $filesystem,
63  new CoreInstaller\GetTypo3OrgService($io)
64  )
65  );
66  $composer
67  ->getInstallationManager()
68  ->addInstaller(
69  new ExtensionInstaller($composer, $filesystem)
70  );
71 
72  $cache = null;
73  if ($composer->getConfig()->get('cache-files-ttl') > 0) {
74  $cache = new Cache($io, $composer->getConfig()->get('cache-files-dir'), 'a-z0-9_./');
75  }
76 
77  $composer
78  ->getDownloadManager()
79  ->setDownloader(
80  't3x',
81  new Downloader\T3xDownloader($io, $composer->getConfig(), null, $cache)
82  );
83  }
84 
88  public function postAutoload(\Composer\Script\Event $event) {
89  $autoloadConnector = new \TYPO3\CMS\Composer\Plugin\Core\AutoloadConnector();
90  $autoloadConnector->linkAutoloader($event);
91  }
92 
93 }