[TASK] Re-work/simplify copyright header in PHP files - Part 9
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / Command / ExtensionCommandController.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\Command;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
18
19 /**
20 * CommandController for working with extension management through CLI/scheduler
21 *
22 * @author Claus Due <claus@namelesscoder.net>
23 */
24 class ExtensionCommandController extends CommandController {
25
26 /**
27 * @var bool
28 */
29 protected $requestAdminPermissions = TRUE;
30
31 /**
32 * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
33 * @inject
34 */
35 protected $signalSlotDispatcher;
36
37 /**
38 * Installs an extension by key
39 *
40 * The extension files must be present in one of the
41 * recognised extension folder paths in TYPO3.
42 *
43 * @param string $extensionKey
44 * @return void
45 */
46 public function installCommand($extensionKey) {
47 $this->emitPackagesMayHaveChangedSignal();
48
49 /** @var $service \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
50 $service = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility');
51 $service->install($extensionKey);
52 }
53
54 /**
55 * Uninstalls an extension by key
56 *
57 * The extension files must be present in one of the
58 * recognised extension folder paths in TYPO3.
59 *
60 * @param string $extensionKey
61 * @return void
62 */
63 public function uninstallCommand($extensionKey) {
64 /** @var $service \TYPO3\CMS\Extensionmanager\Utility\InstallUtility */
65 $service = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\InstallUtility');
66 $service->uninstall($extensionKey);
67 }
68
69 /**
70 * Emits packages may have changed signal
71 */
72 protected function emitPackagesMayHaveChangedSignal() {
73 $this->signalSlotDispatcher->dispatch('PackageManagement', 'packagesMayHaveChanged');
74 }
75 }