Breaking: #97091 - TSFE->clear_preview has been removed

See forge#97091

Description

The method clear_preview of the TypoScriptFrontendController has been removed.

Impact

Calling the method will result in a PHP Fatal Error.

Affected Installations

All installations calling the clear_preview method

Migration

Build your own clear_preview method:

$context = GeneralUtility::makeInstance(Context::class);
$GLOBALS['SIM_EXEC_TIME'] = $GLOBALS['EXEC_TIME'];
$GLOBALS['SIM_ACCESS_TIME'] = $GLOBALS['ACCESS_TIME'];
$context->setAspect(
    'frontend.preview',
    GeneralUtility::makeInstance(PreviewAspect::class)
);
$context->setAspect(
    'date',
    GeneralUtility::makeInstance(
        DateTimeAspect::class,
        new \DateTimeImmutable('@' . $GLOBALS['SIM_EXEC_TIME'])
    )
);
$context->setAspect(
    'visibility',
    GeneralUtility::makeInstance(VisibilityAspect::class)
);