TYPO3 CMS  TYPO3_6-2
ActionController.php
Go to the documentation of this file.
1 <?php
3 
23 
28  protected $installUtility;
29 
35 
41 
46  protected $managementService;
47 
53  protected function toggleExtensionInstallationStateAction($extensionKey) {
55  try {
56  if (in_array($extensionKey, $installedExtensions)) {
57  // uninstall
58  $this->installUtility->uninstall($extensionKey);
59  } else {
60  // install
61  $extension = $this->extensionModelUtility->mapExtensionArrayToModel(
62  $this->installUtility->enrichExtensionWithDetails($extensionKey, FALSE)
63  );
64  if ($this->managementService->installExtension($extension) === FALSE) {
65  $this->redirect('unresolvedDependencies', 'List', NULL, array('extensionKey' => $extensionKey));
66  }
67  }
68  } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
69  $this->addFlashMessage(htmlspecialchars($e->getMessage()), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
70  } catch (\TYPO3\Flow\Package\Exception\PackageStatesFileNotWritableException $e) {
71  $this->addFlashMessage(htmlspecialchars($e->getMessage()), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
72  }
73  $this->redirect('index', 'List', NULL, array(self::TRIGGER_RefreshModuleMenu => TRUE));
74  }
75 
82  public function installExtensionWithoutSystemDependencyCheckAction($extensionKey) {
83  $this->managementService->setSkipSystemDependencyCheck(TRUE);
84  $this->forward('toggleExtensionInstallationState', NULL, NULL, array('extensionKey' => $extensionKey));
85  }
86 
93  protected function removeExtensionAction($extension) {
94  try {
95  $this->installUtility->removeExtension($extension);
96  $this->addFlashMessage(
97  \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
98  'extensionList.remove.message',
99  'extensionmanager',
100  array(
101  'extension' => $extension,
102  )
103  )
104  );
105  } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
106  $this->addFlashMessage(htmlspecialchars($e->getMessage()), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
107  } catch (\TYPO3\Flow\Utility\Exception $e) {
108  $this->addFlashMessage(htmlspecialchars($e->getMessage()), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
109  }
110 
111  return '';
112  }
113 
119  protected function downloadExtensionZipAction($extension) {
120  $fileName = $this->fileHandlingUtility->createZipFileFromExtension($extension);
121  $this->fileHandlingUtility->sendZipFileToBrowserAndDelete($fileName);
122  }
123 
130  protected function downloadExtensionDataAction($extension) {
131  $error = NULL;
132  $sqlData = $this->installUtility->getExtensionSqlDataDump($extension);
133  $dump = $sqlData['extTables'] . $sqlData['staticSql'];
134  $fileName = $extension . '_sqlDump.sql';
135  $filePath = PATH_site . 'typo3temp/' . $fileName;
137  if (is_string($error)) {
138  throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException($error, 1343048718);
139  }
140  $this->fileHandlingUtility->sendSqlDumpFileToBrowserAndDelete($filePath, $fileName);
141  }
142 }
static writeFileToTypo3tempDir($filepath, $content)
forward($actionName, $controllerName=NULL, $extensionName=NULL, array $arguments=NULL)
redirect($actionName, $controllerName=NULL, $extensionName=NULL, array $arguments=NULL, $pageUid=NULL, $delay=0, $statusCode=303)
addFlashMessage($messageBody, $messageTitle='', $severity=\TYPO3\CMS\Core\Messaging\AbstractMessage::OK, $storeInSession=TRUE)