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
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+ }
0 commit comments