[TASK] Re-work/simplify copyright header in PHP files - Part 2
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Ajax / UninstallExtension.php
1 <?php
2 namespace TYPO3\CMS\Install\Controller\Action\Ajax;
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\Core\Utility;
18
19 /**
20 * Uninstall Extensions
21 *
22 * Used for uninstalling an extension (or multiple) via an ajax request.
23 * Warning! No dependency checking is done here, the extension is just removed
24 * from the extension list.
25 *
26 * If you use this class you have to take care of clearing the cache afterwards,
27 * it's not done here because for fully clearing the cache you need a reload
28 * to take care of changed cache configurations due to no longer installed extensions.
29 * Use the clearCache ajax action afterwards.
30 */
31 class UninstallExtension extends AbstractAjaxAction {
32
33 /**
34 * Uninstall one or multiple extensions
35 * Extension keys are read from get vars, more than one extension has to be comma separated
36 * Cache is cleared "hard" after uninstalling
37 *
38 * @return string "OK"
39 */
40 protected function executeAction() {
41 $getVars = Utility\GeneralUtility::_GET('install');
42 if (isset($getVars['uninstallExtension']) && isset($getVars['uninstallExtension']['extensions'])) {
43 $extensionsToUninstall = Utility\GeneralUtility::trimExplode(',', $getVars['uninstallExtension']['extensions']);
44 foreach ($extensionsToUninstall as $extension) {
45 if (Utility\ExtensionManagementUtility::isLoaded($extension)) {
46 Utility\ExtensionManagementUtility::unloadExtension($extension);
47 }
48 }
49 }
50 return 'OK';
51 }
52
53 }