Skip to content
Snippets Groups Projects
Commit 84982f42 authored by Bart Dubelaar's avatar Bart Dubelaar Committed by Benni Mack
Browse files

[BUGFIX] Clear affected caches on page publishing

When publishing a page, the treelist cache should be cleared.
This is fixed by adding a condition that checks for a swap action in
the existing class that hooks into DataHandler and listens for updates to
pages to update the treelist cache.

Change-Id: I0c01450efe9507dcef9f74af626a9ebf3cdc7d4c
Resolves: #37952
Releases: master, 6.2
Reviewed-on: http://review.typo3.org/12195


Reviewed-by: default avatarAndreas Wolf <andreas.wolf@typo3.org>
Tested-by: default avatarAndreas Wolf <andreas.wolf@typo3.org>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent 13991fb8
No related merge requests found
......@@ -89,8 +89,8 @@ class TreelistCacheUpdateHooks {
}
/**
* waits for TCEmain commands and looks for deleted pages, if found further
* changes take place to determine whether the cache needs to be updated
* 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
*
* @param string $command The TCE command
* @param string $table The record's table
......@@ -100,13 +100,26 @@ class TreelistCacheUpdateHooks {
* @return void
*/
public function processCmdmap_postProcess($command, $table, $recordId, $commandValue, DataHandler $tceMain) {
if ($table == 'pages' && $command == 'delete') {
$deletedRecord = BackendUtility::getRecord($table, $recordId, '*', '', FALSE);
$affectedPageUid = $deletedRecord['uid'];
$affectedPagePid = $deletedRecord['pid'];
$action = (string)$commandValue['action'];
if ($table === 'pages' && ($command === 'delete' || ($command === 'version' && $action === 'swap'))) {
$affectedRecord = BackendUtility::getRecord($table, $recordId, '*', '', FALSE);
$affectedPageUid = $affectedRecord['uid'];
$affectedPagePid = $affectedRecord['pid'];
// Faking the updated fields
$updatedFields = array('deleted' => 1);
$clearCacheActions = $this->determineClearCacheActions('update', $updatedFields);
$updatedFields = array();
if ($command === 'delete') {
$updatedFields['deleted'] = 1;
} else {
// page was published to live (swapped)
$updatedFields['t3ver_wsid'] = 0;
}
$clearCacheActions = $this->determineClearCacheActions(
'update',
$updatedFields
);
$this->processClearCacheActions($affectedPageUid, $affectedPagePid, $updatedFields, $clearCacheActions);
}
}
......@@ -298,6 +311,8 @@ class TreelistCacheUpdateHooks {
case 'extendToSubpages':
case 't3ver_wsid':
case 'php_tree_stop':
// php_tree_stop
$actions['allParents'] = TRUE;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment