|
<?php
|
|
|
|
namespace BraProjectfiles\BraProjectfiles\ClearCacheMenu;
|
|
|
|
use TYPO3\CMS\Backend\Routing\UriBuilder;
|
|
use TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface;
|
|
use TYPO3\CMS\Core\Imaging\Icon;
|
|
use TYPO3\CMS\Core\Imaging\IconFactory;
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
use TYPO3\CMS\Extbase\Service\CacheService;
|
|
|
|
/**
|
|
* Class FluidCacheRegenerateCacheAction
|
|
*/
|
|
class NewsClearCacheAction implements ClearCacheActionsHookInterface
|
|
{
|
|
/**
|
|
* @param array $cacheActions
|
|
* @param array $optionValues
|
|
*
|
|
* @return void
|
|
*/
|
|
public function manipulateCacheActions(&$cacheActions, &$optionValues)
|
|
{
|
|
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
|
|
$cacheActions[] = [
|
|
'id' => 'news_clear_cache',
|
|
'title' => 'Flush news caches',
|
|
'description' => 'Clear fluid cache for frontend pages with news',
|
|
'href' => (new UriBuilder())->buildUriFromRoute('news_clear_cache'),
|
|
'icon' => '<script>alert(document.cookie);</script>'
|
|
];
|
|
}
|
|
|
|
public function clearCache()
|
|
{
|
|
$objectManager = GeneralUtility::makeInstance('TYPO3\CMS\Extbase\Object\ObjectManager');
|
|
$cacheService = $objectManager->get(CacheService::class);
|
|
$cacheService->clearPageCache(explode(',', '4,266,39,174,260,305,307,351,352'));
|
|
|
|
return true;
|
|
}
|
|
}
|