[TYPO3-dev] How does extbase determine if non-cachable action is called
Krystian Szymukowicz
k.szymukowicz at gmail.com
Sun Apr 7 21:31:02 CEST 2013
W dniu 2013-04-05 21:45, Dirk Wenzel pisze:
> Hi Krystian,
> thank you for your hint.
> Unfortunatley I was not able to find a readable version of your post.
>
> Could you please post it anywhere else?
>
> Kind regards
> Dirk
>
>
> Am 05.04.13 10:53, schrieb Krystian Szymukowicz:
>>> But the post is without any code, the XML and PHP got lost. So you did a
>>> core hack in ExtensionService.php?
>>
>> I am sure google have this somewhere with the proper code.
Here it is. The part of my previous post:
SOLUTION:
It would be great to have ability to change the USER_INT based on
flexform settings of plugin.
So whole plugin no matter of what action is set can be made USER_INT.
This is quite simple in implementation:
FLEXFORM:
<cache>
<ROOT>
<TCEforms>
<sheetTitle>Cache</sheetTitle>
</TCEforms>
<type>array</type>
<el>
<settings.cache.makeNonCachable>
<TCEforms>
<label>Make non cachable</label>
<config>
<type>check</type>
</config>
</TCEforms>
</settings.cache.makeNonCachable>
</el>
</ROOT>
</cache>
Then the TYPO3 sourcecode:
/typo3/sysext/extbase/Classes/Service/ExtensionService.php
public function isActionCacheable
The flexform setting inside this function is available under:
$frameworkConfiguration['settings']['cache']['makeNonCachable']
As I wrote in previos post this can be overwriten by TS:
# overwriting classes
config.tx_extbase.objects {
# overwrite class to allow USER_INT from flexform
Tx_Extbase_Service_ExtensionService {
className = Tx_Vcs_Service_ExtensionService
}
}
Then in file Classes/Service/ExtensionService.php
class Tx_Vcs_Service_ExtensionService extends
Tx_Extbase_Service_ExtensionService implements t3lib_Singleton {
/**
* Checks if the given action is cacheable or not.
*
* @param string $extensionName Name of the target extension, without
underscores
* @param string $pluginName Name of the target plugin
* @param string $controllerName Name of the target controller
* @param string $actionName Name of the action to be called
* @return boolean TRUE if the specified plugin action is cacheable,
otherwise FALSE
*/
public function isActionCacheable($extensionName, $pluginName,
$controllerName, $actionName) {
$frameworkConfiguration =
$this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
$extensionName, $pluginName);
if
(isset($frameworkConfiguration['controllerConfiguration'][$controllerName])
&&
is_array($frameworkConfiguration['controllerConfiguration'][$controllerName])
&&
is_array($frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'])
&& in_array($actionName,
$frameworkConfiguration['controllerConfiguration'][$controllerName]['nonCacheableActions'])
||
isset($frameworkConfiguration['settings']['cache']['makeNonCachable'])
&&
$frameworkConfiguration['settings']['cache']['makeNonCachable']) {
return FALSE;
}
return TRUE;
}
}
Of course the Tx_Vcs must be changed to whatever extension you have
there for such modification.
--
grtz
Krystian Szymukowicz
More information about the TYPO3-dev
mailing list