1 | <?php |
||
38 | class CacheApiService { |
||
39 | |||
40 | /** |
||
41 | * @var \TYPO3\CMS\Core\DataHandling\DataHandler |
||
42 | */ |
||
43 | protected $dataHandler; |
||
44 | |||
45 | /** |
||
46 | * @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager |
||
47 | */ |
||
48 | protected $objectManager; |
||
49 | |||
50 | /** |
||
51 | * @var \TYPO3\CMS\Install\Service\ClearCacheService |
||
52 | */ |
||
53 | protected $installToolClearCacheService; |
||
54 | |||
55 | /** |
||
56 | * @param \TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler |
||
57 | * |
||
58 | * @return void |
||
59 | */ |
||
60 | public function injectDataHandler(\TYPO3\CMS\Core\DataHandling\DataHandler $dataHandler) { |
||
63 | |||
64 | /** |
||
65 | * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager) { |
||
72 | |||
73 | /** |
||
74 | * @param \TYPO3\CMS\Install\Service\ClearCacheService $installToolClearCacheService |
||
75 | * |
||
76 | * @return void |
||
77 | */ |
||
78 | public function injectInstallToolClearCacheService(\TYPO3\CMS\Install\Service\ClearCacheService $installToolClearCacheService) { |
||
81 | |||
82 | /** |
||
83 | * Initialize the object. |
||
84 | * |
||
85 | * @return void |
||
86 | */ |
||
87 | public function initializeObject() { |
||
88 | // Create a fake admin user |
||
89 | $adminUser = $this->objectManager->get('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication'); |
||
90 | $adminUser->user['uid'] = $GLOBALS['BE_USER']->user['uid']; |
||
91 | $adminUser->user['username'] = '_CLI_lowlevel'; |
||
92 | $adminUser->user['admin'] = 1; |
||
93 | $adminUser->workspace = 0; |
||
94 | |||
95 | $this->dataHandler->start(Array(), Array(), $adminUser); |
||
96 | } |
||
97 | |||
98 | /** |
||
99 | * Clear all caches. |
||
100 | * |
||
101 | * @param bool $hard |
||
102 | * @return void |
||
103 | */ |
||
104 | 1 | public function clearAllCaches($hard = FALSE) { |
|
107 | |||
108 | /** |
||
109 | * Clear the page cache. |
||
110 | * |
||
111 | * @return void |
||
112 | */ |
||
113 | 1 | public function clearPageCache() { |
|
116 | |||
117 | /** |
||
118 | * Clears the configuration cache. |
||
119 | * |
||
120 | * @return void |
||
121 | */ |
||
122 | 1 | public function clearConfigurationCache() { |
|
125 | |||
126 | /** |
||
127 | * Clear the system cache |
||
128 | * |
||
129 | * @return void |
||
130 | */ |
||
131 | 1 | public function clearSystemCache() { |
|
134 | |||
135 | /** |
||
136 | * Clears the opcode cache. |
||
137 | * |
||
138 | * @param string|NULL $fileAbsPath The file as absolute path to be cleared |
||
139 | * or NULL to clear completely. |
||
140 | * |
||
141 | * @return void |
||
142 | */ |
||
143 | public function clearAllActiveOpcodeCache($fileAbsPath = NULL) { |
||
146 | |||
147 | /** |
||
148 | * Clear all caches except the page cache. |
||
149 | * This is especially useful on big sites when you can't |
||
150 | * just drop the page cache. |
||
151 | * |
||
152 | * @return array with list of cleared caches |
||
153 | */ |
||
154 | 1 | public function clearAllExceptPageCache() { |
|
173 | |||
174 | /** |
||
175 | * Clears the opcode cache. This just wraps the static call for testing purposes. |
||
176 | * |
||
177 | * @param string|NULL $fileAbsPath The file as absolute path to be cleared |
||
178 | * or NULL to clear completely. |
||
179 | * |
||
180 | * @return void |
||
181 | */ |
||
182 | protected function clearAllActiveOpcodeCacheWrapper($fileAbsPath) { |
||
189 | } |
||
190 |