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

Commit 54d6f82

Browse files
author
Stefano Kowalke
committed
Add support for TYPO3 6.2 and drop support for all other version below
* Introduce namespaces * Adjust doc comments * Remove closing php tag * Fix typo * Remove the legacy Dispatcher interface close #18 close #47
1 parent 3a83c87 commit 54d6f82

13 files changed

+332
-931
lines changed

Classes/Cli/Dispatcher.php

Lines changed: 0 additions & 649 deletions
This file was deleted.
Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
2+
namespace Etobi\CoreAPI\Command;
3+
24
/***************************************************************
35
* Copyright notice
46
*
57
* (c) 2012 Georg Ringer <[email protected]>
8+
* (c) 2014 Stefano Kowalke <[email protected]>
69
* All rights reserved
710
*
811
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -21,67 +24,72 @@
2124
*
2225
* This copyright notice MUST APPEAR in all copies of the script!
2326
***************************************************************/
27+
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
2428

2529
/**
2630
* API Command Controller
2731
*
28-
* @package TYPO3
29-
* @subpackage tx_coreapi
32+
* @author Georg Ringer <[email protected]>
33+
* @author Stefano Kowalke <[email protected]>
34+
* @package Etobi\CoreAPI\Service\SiteApiService
3035
*/
31-
class Tx_Coreapi_Command_CacheApiCommandController extends Tx_Extbase_MVC_Controller_CommandController {
36+
class CacheApiCommandController extends CommandController {
3237

3338
/**
34-
* Clear all caches
39+
* Clear all caches.
3540
*
3641
* @return void
3742
*/
3843
public function clearAllCachesCommand() {
39-
/** @var $service Tx_Coreapi_Service_CacheApiService */
40-
$service = $this->objectManager->get('Tx_Coreapi_Service_CacheApiService');
44+
$service = $this->getService();
4145
$service->clearAllCaches();
4246

4347
$this->outputLine('All caches have been cleared.');
4448
}
4549

4650
/**
47-
* Clear configuration cache (temp_CACHED_..)
51+
* Clear configuration cache (temp_CACHED_..).
4852
*
4953
* @return void
5054
*/
5155
public function clearConfigurationCacheCommand() {
52-
/** @var $service Tx_Coreapi_Service_CacheApiService */
53-
$service = $this->objectManager->get('Tx_Coreapi_Service_CacheApiService');
56+
$service = $this->getService();
5457
$service->clearConfigurationCache();
5558

5659
$this->outputLine('Configuration cache has been cleared.');
5760
}
5861

5962
/**
60-
* Clear page cache
63+
* Clear page cache.
6164
*
6265
* @return void
6366
*/
6467
public function clearPageCacheCommand() {
65-
/** @var $service Tx_Coreapi_Service_CacheApiService */
66-
$service = $this->objectManager->get('Tx_Coreapi_Service_CacheApiService');
68+
$service = $this->getService();
6769
$service->clearPageCache();
6870

6971
$this->outputLine('Page cache has been cleared.');
7072
}
7173

7274
/**
7375
* Clear all caches except the page cache.
74-
* This is especially useful on big sites when you can't just drop the page cache
76+
* This is especially useful on big sites when you can't just drop the page cache.
7577
*
7678
* @return void
7779
*/
7880
public function clearAllExceptPageCacheCommand() {
79-
/** @var $service Tx_Coreapi_Service_CacheApiService */
80-
$service = $this->objectManager->get('Tx_Coreapi_Service_CacheApiService');
81+
$service = $this->getService();
8182
$clearedCaches = $service->clearAllExceptPageCache();
8283

8384
$this->outputLine('Cleared caches: ' . implode(', ', $clearedCaches));
8485
}
85-
}
8686

87-
?>
87+
/**
88+
* Returns the service object.
89+
*
90+
* @return \Etobi\CoreAPI\Service\CacheApiService object
91+
*/
92+
private function getService() {
93+
return $this->objectManager->get('Etobi\\CoreAPI\\Service\\CacheApiService');
94+
}
95+
}

Classes/Command/DatabaseApiCommandController.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
<?php
2+
namespace Etobi\CoreAPI\Command;
3+
24
/***************************************************************
35
* Copyright notice
46
*
57
* (c) 2012 Georg Ringer <[email protected]>
8+
* (c) 2014 Stefano Kowalke <[email protected]>
69
* All rights reserved
710
*
811
* This script is part of the TYPO3 project. The TYPO3 project is
@@ -21,25 +24,25 @@
2124
*
2225
* This copyright notice MUST APPEAR in all copies of the script!
2326
***************************************************************/
27+
use TYPO3\CMS\Extbase\Mvc\Controller\CommandController;
2428

2529
/**
2630
* API Command Controller
2731
*
28-
* @package TYPO3
29-
* @subpackage tx_coreapi
32+
* @author Georg Ringer <[email protected]>
33+
* @author Stefano Kowalke <[email protected]>
34+
* @package Etobi\CoreAPI\Service\SiteApiService
3035
*/
31-
class Tx_Coreapi_Command_DatabaseApiCommandController extends Tx_Extbase_MVC_Controller_CommandController {
36+
class DatabaseApiCommandController extends CommandController {
3237

3338
/**
34-
* Database compare
35-
*
39+
* Database compare.
3640
* Leave the argument 'actions' empty or use "help" to see the available ones
3741
*
3842
* @param string $actions List of actions which will be executed
3943
*/
4044
public function databaseCompareCommand($actions = '') {
41-
/** @var $service Tx_Coreapi_Service_DatabaseApiService */
42-
$service = $this->objectManager->get('Tx_Coreapi_Service_DatabaseApiService');
45+
$service = $this->getService();
4346

4447
if ($actions === 'help' || strlen($actions) === 0) {
4548
$actions = $service->databaseCompareAvailableActions();
@@ -57,6 +60,13 @@ public function databaseCompareCommand($actions = '') {
5760
$this->quit();
5861
}
5962
}
60-
}
6163

62-
?>
64+
/**
65+
* Returns the service object.
66+
*
67+
* @return \Etobi\CoreAPI\Service\DatabaseApiService object
68+
*/
69+
private function getService() {
70+
return $this->objectManager->get('Etobi\\CoreAPI\\Service\\DatabaseApiService');
71+
}
72+
}

0 commit comments

Comments
 (0)