59 $this->cacheActions = array();
60 $this->optionValues = array();
64 if ($backendUser->isAdmin() || $backendUser->getTSConfigVal(
'options.clearCache.pages')) {
65 $this->cacheActions[] = array(
67 'title' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:flushPageCachesTitle', TRUE),
68 'description' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:flushPageCachesDescription', TRUE),
69 'href' => $this->backPath .
'tce_db.php?vC=' . $backendUser->veriCode() .
'&cacheCmd=pages&ajaxCall=1' .
BackendUtility::getUrlToken(
'tceAction'),
72 $this->optionValues[] =
'pages';
76 if ($backendUser->isAdmin() || $backendUser->getTSConfigVal(
'options.clearCache.all')) {
77 $this->cacheActions[] = array(
79 'title' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesTitle', TRUE),
80 'description' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:flushGeneralCachesDescription', TRUE),
81 'href' => $this->backPath .
'tce_db.php?vC=' . $backendUser->veriCode() .
'&cacheCmd=all&ajaxCall=1' .
BackendUtility::getUrlToken(
'tceAction'),
84 $this->optionValues[] =
'all';
91 if ($backendUser->getTSConfigVal(
'options.clearCache.system')
93 || ((
bool)
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'clearCacheSystem'] === TRUE && $backendUser->isAdmin())) {
94 $this->cacheActions[] = array(
96 'title' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:flushSystemCachesTitle', TRUE),
97 'description' =>
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:flushSystemCachesDescription', TRUE),
98 'href' => $this->backPath .
'tce_db.php?vC=' . $backendUser->veriCode() .
'&cacheCmd=system&ajaxCall=1' .
BackendUtility::getUrlToken(
'tceAction'),
101 $this->optionValues[] =
'system';
104 if (is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'additionalBackendItems'][
'cacheActions'])) {
105 foreach (
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'additionalBackendItems'][
'cacheActions'] as $cacheAction) {
108 throw new \UnexpectedValueException(
'$hookObject must implement interface TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface', 1228262000);
110 $hookObject->manipulateCacheActions($this->cacheActions, $this->optionValues);
122 if ($backendUser->isAdmin()) {
125 if (is_array($this->optionValues)) {
126 foreach ($this->optionValues as $value) {
127 if ($backendUser->getTSConfigVal(
'options.clearCache.' . $value)) {
141 $title =
$GLOBALS[
'LANG']->sL(
'LLL:EXT:lang/locallang_core.xlf:rm.clearCache_clearCache', TRUE);
143 $cacheMenu = array();
144 $cacheMenu[] =
'<a href="#" class="toolbar-item">' .
IconUtility::getSpriteIcon(
'apps-toolbar-menu-cache', array(
'title' => $title)) .
'</a>';
145 $cacheMenu[] =
'<ul class="toolbar-item-menu" style="display: none;">';
146 foreach ($this->cacheActions as $actionKey => $cacheAction) {
147 $cacheMenu[] =
'<li><a href="' . htmlspecialchars($cacheAction[
'href'])
148 .
'" title="' . htmlspecialchars($cacheAction[
'description'] ?: $cacheAction[
'title']) .
'">' 149 . $cacheAction[
'icon'] .
' ' . htmlspecialchars($cacheAction[
'title']) .
'</a></li>';
151 $cacheMenu[] =
'</ul>';
152 return implode(LF, $cacheMenu);
161 $this->backendReference->addJavascriptFile(
'sysext/backend/Resources/Public/JavaScript/clearcachemenu.js');
170 return 'id="clear-cache-actions-menu"';
static getUserObj($classRef, $checkPrefix='', $silent=FALSE)
static getUrlToken($formName='securityToken', $tokenName='formToken')
static getSpriteIcon($iconName, array $options=array(), array $overlays=array())
static getApplicationContext()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]