Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit da1428e

Browse files
author
Georg Ringer
committed
Restructure
1 parent 80eb367 commit da1428e

File tree

4 files changed

+33
-18
lines changed

4 files changed

+33
-18
lines changed

Classes/Command/ApiCommandController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function databaseCompareCommand($actions = '') {
5050
$this->quit();
5151
}
5252

53+
/** @var $service Tx_Coreapi_Service_DatabaseApiService */
5354
$service = $this->objectManager->get('Tx_Coreapi_Service_DatabaseApiService');
5455
$allowedActions = array();
5556
$actionSplit = t3lib_div::trimExplode(',', $actions);

Classes/Command/CacheApiCommandController.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ class Tx_Coreapi_Command_CacheApiCommandController extends Tx_Extbase_MVC_Contro
3636
* @return void
3737
*/
3838
public function clearAllCacheCommand() {
39-
$this->objectManager->get('Tx_Coreapi_Service_CacheApiService')->clearAllCaches();
39+
/** @var $service Tx_Coreapi_Service_CacheApiService */
40+
$service = $this->objectManager->get('Tx_Coreapi_Service_CacheApiService');
41+
$service->clearAllCaches();
42+
4043
$this->outputLine('All caches have been cleared.');
4144
}
4245

@@ -46,7 +49,10 @@ public function clearAllCacheCommand() {
4649
* @return void
4750
*/
4851
public function clearConfigurationCacheCommand() {
49-
$this->objectManager->get('Tx_Coreapi_Service_CacheApiService')->clearConfigurationCache();
52+
/** @var $service Tx_Coreapi_Service_CacheApiService */
53+
$service = $this->objectManager->get('Tx_Coreapi_Service_CacheApiService');
54+
$service->clearConfigurationCache();
55+
5056
$this->outputLine('Configuration Cache has been cleared.');
5157
}
5258

Classes/Command/ExtensionApiCommandController.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,18 @@ class Tx_Coreapi_Command_ExtensionApiCommandController extends Tx_Extbase_MVC_Co
3737
* @return void
3838
*/
3939
public function listInstalledCommand($type = '') {
40-
$type = strtoupper($type);
40+
$type = strtoupper($type);
4141
if (!empty($type) && $type !== 'L' && $type !== 'G' && $type !== 'S') {
4242
$this->outputLine('Only "L", "S" and "G" are supported as type (or nothing)');
4343
$this->quit();
4444
}
4545

46-
$extensions = $GLOBALS['TYPO3_LOADED_EXT'];
46+
/** @var $extensions Tx_Coreapi_Service_ExtensionApiService */
47+
$extensions = $this->objectManager->get('Tx_Coreapi_Service_ExtensionApiService')->getInstalledExtensions($type);
4748

48-
$list = array();
49-
foreach ($extensions as $key => $extension) {
50-
if (!empty($type) && $type !== $extension['type']) {
51-
continue;
52-
}
53-
$list[$key] = $extension['ext_tables.sql'];
54-
}
55-
56-
ksort($list);
57-
58-
foreach ($list as $key => $description) {
59-
include_once(t3lib_extMgm::extPath($key) . 'ext_emconf.php');
60-
$title = $key . ' - ' . $EM_CONF['']['version'] . '/' . $EM_CONF['']['state'];
61-
$description = $EM_CONF['']['title'];
49+
foreach ($extensions as $key => $details) {
50+
$title = $key . ' - ' . $details['version'] . '/' . $details['state'];
51+
$description = $details['title'];
6252
$description = wordwrap($description, self::MAXIMUM_LINE_LENGTH - 43, PHP_EOL . str_repeat(' ', 43), TRUE);
6353
$this->outputLine('%-2s%-40s %s', array(' ', $title, $description));
6454
}

Classes/Service/ExtensionApiService.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,24 @@ class Tx_Coreapi_Service_ExtensionApiService {
3939
extension:uninstall Uninstalls an extension
4040
extension:refresh Refreshes the local cache of all extensions available in TER
4141
*/
42+
43+
public function getInstalledExtensions($type = '') {
44+
$extensions = $GLOBALS['TYPO3_LOADED_EXT'];
45+
46+
$list = array();
47+
foreach ($extensions as $key => $extension) {
48+
if (!empty($type) && $type !== $extension['type']) {
49+
continue;
50+
}
51+
52+
include_once(t3lib_extMgm::extPath($key) . 'ext_emconf.php');
53+
$list[$key] = $EM_CONF[''];
54+
}
55+
56+
ksort($list);
57+
58+
return $list;
59+
}
4260
}
4361

4462
?>

0 commit comments

Comments
 (0)