TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
CacheHashCalculator Class Reference
Inheritance diagram for CacheHashCalculator:
SingletonInterface

Public Member Functions

 __construct ()
 
 calculateCacheHash (array $params)
 
 generateForParameters ($queryString)
 
 doParametersRequireCacheHash ($queryString)
 
 getRelevantParameters ($queryString)
 
 setConfiguration (array $configuration)
 

Protected Member Functions

 splitQueryStringToArray ($queryString)
 
 isAdminPanelParameter ($key)
 
 isCoreParameter ($key)
 
 isExcludedParameter ($key)
 
 isInCachedParametersWhiteList ($key)
 
 hasCachedParametersWhiteList ()
 
 isAllowedWithEmptyValue ($key)
 
 setCachedParametersWhiteList (array $cachedParametersWhiteList)
 
 setIncludePageId ($includePageId)
 
 setExcludeAllEmptyParameters ($excludeAllEmptyParameters)
 
 setExcludedParameters (array $excludedParameters)
 
 setExcludedParametersIfEmpty (array $excludedParametersIfEmpty)
 
 setRequireCacheHashPresenceParameters (array $requireCacheHashPresenceParameters)
 

Protected Attributes

 $cachedParametersWhiteList = []
 
 $excludedParameters = []
 
 $requireCacheHashPresenceParameters = []
 
 $excludedParametersIfEmpty = []
 
 $excludeAllEmptyParameters = false
 
 $includePageId = false
 

Detailed Description

Logic for cHash calculation

Definition at line 22 of file CacheHashCalculator.php.

Constructor & Destructor Documentation

__construct ( )

Initialise class properties by using the relevant TYPO3 configuration

Definition at line 57 of file CacheHashCalculator.php.

References $GLOBALS, and CacheHashCalculator\setConfiguration().

Member Function Documentation

calculateCacheHash ( array  $params)

Calculates the cHash based on the provided parameters

Parameters
array$paramsArray of cHash key-value pairs
Returns
string Hash of all the values

Definition at line 68 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\generateForParameters().

doParametersRequireCacheHash (   $queryString)

Checks whether a parameter of the given $queryString requires cHash calculation

Parameters
string$queryString
Returns
bool

Definition at line 92 of file CacheHashCalculator.php.

References CacheHashCalculator\splitQueryStringToArray().

generateForParameters (   $queryString)

Returns the cHash based on provided query parameters and added values from internal call

Parameters
string$queryStringQuery-parameters: "&xxx=yyy&zzz=uuu
Returns
string Hash of all the values
Exceptions
RuntimeException

Definition at line 80 of file CacheHashCalculator.php.

References CacheHashCalculator\calculateCacheHash(), and CacheHashCalculator\getRelevantParameters().

getRelevantParameters (   $queryString)

Splits the input query-parameters into an array with certain parameters filtered out. Used to create the cHash value

Parameters
string$queryStringQuery-parameters: "&xxx=yyy&zzz=uuu
Returns
array Array with key/value pairs of query-parameters WITHOUT a certain list of
Exceptions
RuntimeException
See also
::makeCacheHash(), ::typoLink()

Definition at line 117 of file CacheHashCalculator.php.

References $GLOBALS, CacheHashCalculator\hasCachedParametersWhiteList(), CacheHashCalculator\isAdminPanelParameter(), CacheHashCalculator\isAllowedWithEmptyValue(), CacheHashCalculator\isCoreParameter(), CacheHashCalculator\isExcludedParameter(), CacheHashCalculator\isInCachedParametersWhiteList(), and CacheHashCalculator\splitQueryStringToArray().

Referenced by CacheHashCalculator\generateForParameters().

hasCachedParametersWhiteList ( )
protected

Checks whether cachedParametersWhiteList parameters are configured

Returns
bool

Definition at line 221 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\getRelevantParameters().

isAdminPanelParameter (   $key)
protected

Checks whether the given parameter starts with TSFE_ADMIN_PANEL stripos check added to avoid bad performance

Parameters
string$key
Returns
bool

Definition at line 178 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\getRelevantParameters().

isAllowedWithEmptyValue (   $key)
protected

Check whether the given parameter may be used even with an empty value

Parameters
$key
Returns
bool

Definition at line 232 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\getRelevantParameters().

isCoreParameter (   $key)
protected

Checks whether the given parameter is a core parameter

Parameters
string$key
Returns
bool

Definition at line 189 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\getRelevantParameters().

isExcludedParameter (   $key)
protected

Checks whether the given parameter should be excluded from cHash calculation

Parameters
string$key
Returns
bool

Definition at line 200 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\getRelevantParameters().

isInCachedParametersWhiteList (   $key)
protected

Checks whether the given parameter is an exclusive parameter for cHash calculation

Parameters
string$key
Returns
bool

Definition at line 211 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\getRelevantParameters().

setCachedParametersWhiteList ( array  $cachedParametersWhiteList)
protected
Parameters
array$cachedParametersWhiteList

Definition at line 256 of file CacheHashCalculator.php.

References CacheHashCalculator\$cachedParametersWhiteList.

setConfiguration ( array  $configuration)

Loops through the configuration array and calls the accordant getters with the value.

Parameters
array$configuration

Definition at line 243 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\__construct().

setExcludeAllEmptyParameters (   $excludeAllEmptyParameters)
protected
Parameters
bool$excludeAllEmptyParameters

Definition at line 272 of file CacheHashCalculator.php.

References CacheHashCalculator\$excludeAllEmptyParameters.

setExcludedParameters ( array  $excludedParameters)
protected
Parameters
array$excludedParameters

Definition at line 280 of file CacheHashCalculator.php.

References CacheHashCalculator\$excludedParameters.

setExcludedParametersIfEmpty ( array  $excludedParametersIfEmpty)
protected
Parameters
array$excludedParametersIfEmpty

Definition at line 288 of file CacheHashCalculator.php.

References CacheHashCalculator\$excludedParametersIfEmpty.

setIncludePageId (   $includePageId)
protected
Parameters
bool$includePageId

Definition at line 264 of file CacheHashCalculator.php.

References CacheHashCalculator\$includePageId.

setRequireCacheHashPresenceParameters ( array  $requireCacheHashPresenceParameters)
protected
Parameters
array$requireCacheHashPresenceParameters

Definition at line 296 of file CacheHashCalculator.php.

References CacheHashCalculator\$requireCacheHashPresenceParameters.

splitQueryStringToArray (   $queryString)
protected

Parses the query string and converts it to an array. Unlike parse_str it only creates an array with one level.

e.g. foo[bar]=baz will be array('foo[bar]' => 'baz')

Parameters
string$queryString
Returns
array

Definition at line 156 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\doParametersRequireCacheHash(), and CacheHashCalculator\getRelevantParameters().

Member Data Documentation

$cachedParametersWhiteList = []
protected
$excludeAllEmptyParameters = false
protected
$excludedParameters = []
protected

Definition at line 32 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\setExcludedParameters().

$excludedParametersIfEmpty = []
protected
$includePageId = false
protected

Definition at line 52 of file CacheHashCalculator.php.

Referenced by CacheHashCalculator\setIncludePageId().

$requireCacheHashPresenceParameters = []
protected