TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
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

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

Private Attributes

 $updateRequiringFields
 

Detailed Description

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

Definition at line 27 of file TreelistCacheUpdateHooks.php.

Constructor & Destructor Documentation

__construct ( )

Constructor, adds update requiring fields to the default ones

Definition at line 44 of file TreelistCacheUpdateHooks.php.

References $GLOBALS, and GeneralUtility\trimExplode().

Member Function Documentation

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 245 of file TreelistCacheUpdateHooks.php.

References BackendUtility\BEgetRootLine(), and GeneralUtility\makeInstance().

Referenced by TreelistCacheUpdateHooks\processClearCacheActions().

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 276 of file TreelistCacheUpdateHooks.php.

References GeneralUtility\makeInstance().

Referenced by TreelistCacheUpdateHooks\processClearCacheActions().

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$statusDataHandler 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 337 of file TreelistCacheUpdateHooks.php.

References $GLOBALS.

Referenced by TreelistCacheUpdateHooks\moveRecord_afterAnotherElementPostProcess(), TreelistCacheUpdateHooks\moveRecord_firstElementPostProcess(), TreelistCacheUpdateHooks\processCmdmap_postProcess(), and TreelistCacheUpdateHooks\processDatamap_afterDatabaseOperations().

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$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$dataHandlerDataHandler parent object
Returns
void

Definition at line 170 of file TreelistCacheUpdateHooks.php.

References TreelistCacheUpdateHooks\determineClearCacheActions(), TreelistCacheUpdateHooks\processClearCacheActions(), and TreelistCacheUpdateHooks\requiresUpdate().

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$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$dataHandlerDataHandler parent object
Returns
void

Definition at line 143 of file TreelistCacheUpdateHooks.php.

References TreelistCacheUpdateHooks\determineClearCacheActions(), TreelistCacheUpdateHooks\processClearCacheActions(), and TreelistCacheUpdateHooks\requiresUpdate().

processClearCacheActions (   $affectedPage,
  $affectedParentPage,
  $updatedFields,
array  $actions 
)
protected

Calls the cache maintenance functions according to the determined actions

Parameters
int$affectedPageuid of the affected page
int$affectedParentPageparent uid of the affected page
array$updatedFieldsArray of updated fields and their new values
array$actionsArray of actions to carry out
Returns
void

Definition at line 212 of file TreelistCacheUpdateHooks.php.

References TreelistCacheUpdateHooks\clearCacheForAllParents(), TreelistCacheUpdateHooks\clearCacheWhereUidInTreelist(), TreelistCacheUpdateHooks\removeExpiredCacheEntries(), and TreelistCacheUpdateHooks\setCacheExpiration().

Referenced by TreelistCacheUpdateHooks\moveRecord_afterAnotherElementPostProcess(), TreelistCacheUpdateHooks\moveRecord_firstElementPostProcess(), TreelistCacheUpdateHooks\processCmdmap_postProcess(), and TreelistCacheUpdateHooks\processDatamap_afterDatabaseOperations().

processCmdmap_postProcess (   $command,
  $table,
  $recordId,
  $commandValue,
DataHandler  $dataHandler 
)

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$dataHandlerThe DataHandler parent object
Returns
void

Definition at line 106 of file TreelistCacheUpdateHooks.php.

References TreelistCacheUpdateHooks\determineClearCacheActions(), BackendUtility\getRecord(), and TreelistCacheUpdateHooks\processClearCacheActions().

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$statusDataHandler 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 fields and their new values
DataHandler$dataHandlerDataHandler parent object
Returns
void

Definition at line 72 of file TreelistCacheUpdateHooks.php.

References TreelistCacheUpdateHooks\determineClearCacheActions(), BackendUtility\getRecord(), TreelistCacheUpdateHooks\processClearCacheActions(), and TreelistCacheUpdateHooks\requiresUpdate().

removeExpiredCacheEntries ( )
protected

Removes all expired treelist cache entries

Returns
void

Definition at line 314 of file TreelistCacheUpdateHooks.php.

References $GLOBALS, and GeneralUtility\makeInstance().

Referenced by TreelistCacheUpdateHooks\processClearCacheActions().

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 190 of file TreelistCacheUpdateHooks.php.

Referenced by TreelistCacheUpdateHooks\moveRecord_afterAnotherElementPostProcess(), TreelistCacheUpdateHooks\moveRecord_firstElementPostProcess(), and TreelistCacheUpdateHooks\processDatamap_afterDatabaseOperations().

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 296 of file TreelistCacheUpdateHooks.php.

References GeneralUtility\makeInstance().

Referenced by TreelistCacheUpdateHooks\processClearCacheActions().

Member Data Documentation

$updateRequiringFields
private
Initial value:
= [
'pid',
'php_tree_stop',
'extendToSubpages'
]

Definition at line 35 of file TreelistCacheUpdateHooks.php.