‪TYPO3CMS  ‪main
TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks Class Reference

Public Member Functions

 __construct ()
 
 processDatamap_afterDatabaseOperations ($status, $table, $recordId, array $updatedFields, DataHandler $dataHandler)
 
 processCmdmap_postProcess ($command, $table, $recordId, $commandValue, DataHandler $dataHandler)
 
 moveRecord_firstElementPostProcess ($table, $recordId, $destinationPid, array $movedRecord, array $updatedFields, DataHandler $dataHandler)
 
 moveRecord_afterAnotherElementPostProcess ($table, $recordId, $destinationPid, $originalDestinationPid, array $movedRecord, array $updatedFields, DataHandler $dataHandler)
 

Protected Member Functions

bool requiresUpdate (array $updatedFields)
 
 processClearCacheActions ($affectedPage, $affectedParentPage, $updatedFields, array $actions)
 
 clearCacheForAllParents ($affectedParentPage)
 
 clearCacheWhereUidInTreelist ($affectedPage)
 
 setCacheExpiration ($affectedPage, $expirationTime)
 
 removeExpiredCacheEntries ()
 
array determineClearCacheActions ($status, $updatedFields)
 

Private Attributes

array $updateRequiringFields
 

Detailed Description

Class that hooks into DataHandler and listens for updates to pages to update the treelist cache

this is a concrete TYPO3 hook implementation and solely used for EXT:frontend and not part of TYPO3's Core API.

Definition at line 29 of file TreelistCacheUpdateHooks.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::__construct ( )

Constructor, adds update requiring fields to the default ones

Definition at line 45 of file TreelistCacheUpdateHooks.php.

References $GLOBALS, and TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode().

Member Function Documentation

◆ clearCacheForAllParents()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::clearCacheForAllParents (   $affectedParentPage)
protected

Clears the treelist cache for all parents of a changed page. gets called after creating a new page and after moving a page

Parameters
int$affectedParentPage‪Parent page id of the changed page, the page to start clearing from

Definition at line 243 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Core\Database\Connection\PARAM_INT_ARRAY.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions().

◆ clearCacheWhereUidInTreelist()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::clearCacheWhereUidInTreelist (   $affectedPage)
protected

Clears the treelist cache for all pages where the affected page is found in the treelist

Parameters
int$affectedPage‪ID of the changed page

Definition at line 273 of file TreelistCacheUpdateHooks.php.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions().

◆ determineClearCacheActions()

array TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::determineClearCacheActions (   $status,
  $updatedFields 
)
protected

Determines what happened to the page record, this is necessary to clear as less cache entries as needed later

Parameters
string$status‪DataHandler operation status, either 'new' or 'update'
array$updatedFields‪Array of updated fields
Returns
‪array List of actions that happened to the page record

Definition at line 331 of file TreelistCacheUpdateHooks.php.

References $GLOBALS.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\moveRecord_afterAnotherElementPostProcess(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\moveRecord_firstElementPostProcess(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processCmdmap_postProcess(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processDatamap_afterDatabaseOperations().

◆ moveRecord_afterAnotherElementPostProcess()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::moveRecord_afterAnotherElementPostProcess (   $table,
  $recordId,
  $destinationPid,
  $originalDestinationPid,
array  $movedRecord,
array  $updatedFields,
DataHandler  $dataHandler 
)

Waits for DataHandler commands and looks for moved pages, if found further changes take place to determine whether the cache needs to be updated

Parameters
string$table‪Table name of the moved record
int$recordId‪The record's uid
int$destinationPid‪The record's destination page id
int$originalDestinationPid‪(negative) page id th page has been moved after
array$movedRecord‪The record that moved
array$updatedFields‪Array of changed fields
DataHandler$dataHandler‪DataHandler parent object

Definition at line 170 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\determineClearCacheActions(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\requiresUpdate().

◆ moveRecord_firstElementPostProcess()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::moveRecord_firstElementPostProcess (   $table,
  $recordId,
  $destinationPid,
array  $movedRecord,
array  $updatedFields,
DataHandler  $dataHandler 
)

waits for DataHandler commands and looks for moved pages, if found further changes take place to determine whether the cache needs to be updated

Parameters
string$table‪Table name of the moved record
int$recordId‪The record's uid
int$destinationPid‪The record's destination page id
array$movedRecord‪The record that moved
array$updatedFields‪Array of changed fields
DataHandler$dataHandler‪DataHandler parent object

Definition at line 144 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\determineClearCacheActions(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\requiresUpdate().

◆ processClearCacheActions()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::processClearCacheActions (   $affectedPage,
  $affectedParentPage,
  $updatedFields,
array  $actions 
)
protected

◆ processCmdmap_postProcess()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::processCmdmap_postProcess (   $command,
  $table,
  $recordId,
  $commandValue,
DataHandler  $dataHandler 
)

Waits for DataHandler commands and looks for deleted pages or published pages, if found further changes take place to determine whether the cache needs to be updated

Parameters
string$command‪The TCE command
string$table‪The record's table
int$recordId‪The record's uid
array$commandValue‪The commands value, typically an array with more detailed command information
DataHandler$dataHandler‪The DataHandler parent object

Definition at line 105 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\determineClearCacheActions(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions().

◆ processDatamap_afterDatabaseOperations()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::processDatamap_afterDatabaseOperations (   $status,
  $table,
  $recordId,
array  $updatedFields,
DataHandler  $dataHandler 
)

waits for DataHandler commands and looks for changed pages, if found further changes take place to determine whether the cache needs to be updated

Parameters
string$status‪DataHandler operation status, either 'new' or 'update'
string$table‪The DB table the operation was carried out on
mixed$recordId‪The record's uid for update records, a string to look the record's uid up after it has been created
array$updatedFields‪Array of changed fields and their new values
DataHandler$dataHandler‪DataHandler parent object

Definition at line 72 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\determineClearCacheActions(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\requiresUpdate().

◆ removeExpiredCacheEntries()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::removeExpiredCacheEntries ( )
protected

Removes all expired treelist cache entries

Definition at line 308 of file TreelistCacheUpdateHooks.php.

References $GLOBALS, and TYPO3\CMS\Core\Database\Connection\PARAM_INT.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions().

◆ requiresUpdate()

bool TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::requiresUpdate ( array  $updatedFields)
protected

Checks whether the change requires an update of the treelist cache

Parameters
array$updatedFields‪Array of changed fields
Returns
‪bool TRUE if the treelist cache needs to be updated, FALSE if no update to the cache is required

Definition at line 190 of file TreelistCacheUpdateHooks.php.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\moveRecord_afterAnotherElementPostProcess(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\moveRecord_firstElementPostProcess(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processDatamap_afterDatabaseOperations().

◆ setCacheExpiration()

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::setCacheExpiration (   $affectedPage,
  $expirationTime 
)
protected

Sets an expiration time for all cache entries having the changed page in the treelist.

Parameters
int$affectedPage‪Uid of the changed page
int$expirationTime

Definition at line 292 of file TreelistCacheUpdateHooks.php.

Referenced by TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions().

Member Data Documentation

◆ $updateRequiringFields

array TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::$updateRequiringFields
private
Initial value:
= array(
'pid',
'php_tree_stop',
'extendToSubpages',
)

Should not be manipulated from others except through the configuration provided

See also
__construct()

Definition at line 36 of file TreelistCacheUpdateHooks.php.