TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks Class Reference

Public Member Functions

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

Protected Member Functions

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

Private Attributes

 $updateRequiringFields
 

Detailed Description

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

Definition at line 25 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 42 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$affectedParentPageParent page id of the changed page, the page to start clearing from
Returns
void

Definition at line 243 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Backend\Utility\BackendUtility\BEgetRootLine(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\getDatabaseConnection().

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$affectedPageID of the changed page
Returns
void

Definition at line 265 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\getDatabaseConnection().

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

◆ determineClearCacheActions()

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$statusTCEmain operation status, either 'new' or 'update'
array$updatedFieldsArray of updated fields
Returns
string List of actions that happened to the page record

Definition at line 303 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().

◆ getDatabaseConnection()

◆ moveRecord_afterAnotherElementPostProcess()

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

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

Parameters
string$tableTable name of the moved record
int$recordIdThe record's uid
int$destinationPidThe record's destination page id
int$originalDestinationPid(negative) page id th page has been moved after
array$movedRecordThe record that moved
array$updatedFieldsArray of changed fields
DataHandler$tceMainTCEmain parent object
Returns
void

Definition at line 168 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  $tceMain 
)

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

Parameters
string$tableTable name of the moved record
int$recordIdThe record's uid
int$destinationPidThe record's destination page id
array$movedRecordThe record that moved
array$updatedFieldsArray of changed fields
DataHandler$tceMainTCEmain parent object
Returns
void

Definition at line 141 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  $tceMain 
)

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

Parameters
string$commandThe TCE command
string$tableThe record's table
int$recordIdThe record's uid
array$commandValueThe commands value, typically an array with more detailed command information
DataHandler$tceMainThe TCEmain parent object
Returns
void

Definition at line 104 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\determineClearCacheActions(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions().

◆ processDatamap_afterDatabaseOperations()

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

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

Parameters
string$statusTCEmain operation status, either 'new' or 'update'
string$tableThe DB table the operation was carried out on
mixed$recordIdThe record's uid for update records, a string to look the record's uid up after it has been created
array$updatedFieldsArray of changed fiels and their new values
DataHandler$tceMainTCEmain parent object
Returns
void

Definition at line 70 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\determineClearCacheActions(), TYPO3\CMS\Backend\Utility\BackendUtility\getRecord(), TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\processClearCacheActions(), and TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\requiresUpdate().

◆ removeExpiredCacheEntries()

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

◆ requiresUpdate()

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

Checks whether the change requires an update of the treelist cache

Parameters
array$updatedFieldsArray 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 188 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$affectedPageUid of the changed page
int$expirationTime
Returns
void

Definition at line 278 of file TreelistCacheUpdateHooks.php.

References TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks\getDatabaseConnection().

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

Member Data Documentation

◆ $updateRequiringFields

TYPO3\CMS\Frontend\Hooks\TreelistCacheUpdateHooks::$updateRequiringFields
private
Initial value:
= [
'pid',
'php_tree_stop',
'extendToSubpages'
]

Definition at line 33 of file TreelistCacheUpdateHooks.php.