Skip to content

Commit

Permalink
Workaround to circumvent TYPO3 disturbing caching
Browse files Browse the repository at this point in the history
 - Clear the stored page cache (for presentations viewer only!) on calling

UB-Mannheim/kitodo-presentation-docker#18
Signed-off-by: Christos Sidiropoulos <csidirop@runbox.com>
  • Loading branch information
csidirop committed Dec 6, 2022
1 parent 2816a42 commit 99a3038
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Classes/Plugin/PageView.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,19 @@ protected function parseOCRengines(string $ocrEnginesPath):void{
setcookie('tx-dlf-ocrEngines', self::$ocrEngines, ['SameSite' => 'lax']);
}

/**
* This function is a workaround to circumvent TYPO3 disturbing caching.
* It clears the stored page cache (for presentations viewer only!) on calling.
*
* @access protected
*
* @return void
*/
protected function clearPageCache():void{
$objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
$objectManager->get(\TYPO3\CMS\Extbase\Service\CacheService::class)->clearPageCache($GLOBALS['TSFE']->id);
}

/**
* The main method of the PlugIn
*
Expand All @@ -412,6 +425,7 @@ public function main($content, $conf)
$this->init($conf);
$this->loadDocument(); // Load current document
$this->parseOCRengines(GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('dlf')['ocrEngines']);
$this->clearPageCache();
//Proccess request: Do OCR on given image(s):
if ($_POST["request"]) {
$this->generateFullText();
Expand Down

0 comments on commit 99a3038

Please sign in to comment.