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

Commit d1a8fb7

Browse files
committed
Merge branch 'master' into develop
2 parents 366e192 + 5d250b2 commit d1a8fb7

File tree

6 files changed

+110
-4
lines changed

6 files changed

+110
-4
lines changed

Classes/Command/CacheApiCommandController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function injectCacheApiService(\Etobi\CoreAPI\Service\CacheApiService $ca
8484
public function clearAllCachesCommand($hard = false) {
8585
$this->cacheApiService->clearAllCaches($hard);
8686
$message = 'All caches have been cleared%s.';
87-
$this->logger->info($message);
87+
$this->logger->info(sprintf($message, $hard ? ' hard' : ''));
8888
$this->outputLine($message, $hard ? array(' hard') : array(''));
8989
}
9090

@@ -158,4 +158,4 @@ public function clearAllExceptPageCacheCommand() {
158158
$this->logger->info($message);
159159
$this->outputLine($message);
160160
}
161-
}
161+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
namespace Etobi\CoreAPI\Command;
3+
4+
/***************************************************************
5+
* Copyright notice
6+
*
7+
* (c) 2014 Achim Fritz <[email protected]>
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 TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
28+
29+
/**
30+
* Configuration API Command Controller
31+
*
32+
* @package TYPO3
33+
* @subpackage coreapi
34+
*/
35+
class ConfigurationApiCommandController extends CommandController {
36+
37+
/**
38+
* @var \Etobi\CoreAPI\Service\ConfigurationApiService
39+
* @inject
40+
*/
41+
protected $configurationApiService;
42+
43+
/**
44+
* List all configurations
45+
*
46+
* @return string
47+
*/
48+
public function listCommand() {
49+
$this->outputLine(json_encode($this->configurationApiService->getConfigurationArray()));
50+
}
51+
52+
/**
53+
* Get configuration value for given key
54+
*
55+
* @param string $key
56+
* @return string
57+
*/
58+
public function showCommand($key) {
59+
$this->outputLine(json_encode($this->configurationApiService->getValue($key)));
60+
}
61+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
namespace Etobi\CoreAPI\Service;
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+
use TYPO3\CMS\Core\Utility\GeneralUtility;
17+
use TYPO3\CMS\Extbase\Reflection\ObjectAccess;
18+
19+
/**
20+
* Site API service
21+
*
22+
* @author Tobias Liebig <[email protected]>
23+
* @package Etobi\CoreAPI\Service\ConfigurationApiService
24+
*/
25+
class ConfigurationApiService {
26+
27+
/**
28+
* @param string $key
29+
* @return mixed
30+
*/
31+
public function getValue($key) {
32+
return ObjectAccess::getPropertyPath($this->getConfigurationArray(), $key);
33+
}
34+
35+
/**
36+
* Returns the configuration array
37+
*
38+
* @return array
39+
*/
40+
public function getConfigurationArray() {
41+
return $GLOBALS['TYPO3_CONF_VARS'];
42+
}
43+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Checkout the project website at forge.typo3.org:
2323
* fetch an extension from TER
2424
* import an extension
2525
* install / uninstall extension
26-
* create upload folders
26+
* ~~create upload folders~~
2727
* configure extension
2828
* SiteApi
2929
* info

ext_autoload.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'Etobi\CoreAPI\Command\SiteApiCommandController' => $extensionClassesPath . 'Command/SiteApiCommandController.php',
1010
'Etobi\CoreAPI\Command\CacheApiCommandController' => $extensionClassesPath . 'Command/CacheApiCommandController.php',
1111
'Etobi\CoreAPI\Command\ExtensionApiCommandController' => $extensionClassesPath . 'Command/ExtensionApiCommandController.php',
12+
'Etobi\CoreAPI\Command\ConfigurationApiCommandController' => $extensionClassesPath . 'Command/ConfigurationApiCommandController.php',
1213
'Etobi\CoreAPI\Service\CacheApiService' => $extensionClassesPath . 'Service/CacheApiService.php',
1314
'Etobi\CoreAPI\Service\SiteApiService' => $extensionClassesPath . 'Service/SiteApiService.php',
1415
'Etobi\CoreAPI\Service\DatabaseApiService' => $extensionClassesPath . 'Service/DatabaseApiService.php',

ext_localconf.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@
88
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Etobi\CoreAPI\Command\CacheApiCommandController';
99
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Etobi\CoreAPI\Command\SiteApiCommandController';
1010
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Etobi\CoreAPI\Command\ExtensionApiCommandController';
11-
}
11+
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['extbase']['commandControllers'][] = 'Etobi\CoreAPI\Command\ConfigurationApiCommandController';
12+
}

0 commit comments

Comments
 (0)