-
Notifications
You must be signed in to change notification settings - Fork 23
/
ext_localconf.php
executable file
·91 lines (82 loc) · 4.3 KB
/
ext_localconf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
use In2code\In2publishCore\Component\ConfigContainer\Provider\PageTsProvider;
use In2code\In2publishCore\Component\Core\Record\Model\Extension\RecordExtensionTrait;
use In2code\In2publishCore\Controller\FrontendController;
use In2code\In2publishCore\Log\Processor\BackendUserProcessor;
use In2code\In2publishCore\Log\Processor\PublishingFailureCollector;
use In2code\In2publishCore\Service\Context\ContextService;
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Log\LogLevel;
use TYPO3\CMS\Core\Log\Writer\DatabaseWriter;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
use TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask;
(static function (): void {
/***************************************************** Guards *****************************************************/
if (!defined('TYPO3')) {
die('Access denied.');
}
if (!class_exists(ContextService::class)) {
// Early return when installing per ZIP: autoload is not yet generated
return;
}
/************************************************ Record Extension ************************************************/
$file = Environment::getVarPath() . '/cache/code/content_publisher/record_extension_trait.php';
if (file_exists($file)) {
// Initialize the variable to be able to use it in a reference
$autoloadFn = null;
/**
* This is a one-time autoloader that loads the compiled RecordExtensionTrait instead of the original.
* To keep the auto-loading overhead low, the function unregisters itself,
* so it will not interfere with further class loading.
*/
$autoloadFn = static function (string $class) use (&$autoloadFn, $file): void {
if (RecordExtensionTrait::class === $class) {
spl_autoload_unregister($autoloadFn);
unset($autoloadFn);
include $file;
}
};
spl_autoload_register($autoloadFn, true, true);
}
/*********************************************** Settings/Instances ***********************************************/
$extConf = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('in2publish_core');
/************************************************** Init Caching **************************************************/
if (!isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['in2publish_core'])) {
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['in2publish_core'] = [];
}
/************************************************** Init Logging **************************************************/
$logLevel = $extConf['logLevel'];
$logLevel = LogLevel::getInternalName((int)$logLevel);
$GLOBALS['TYPO3_CONF_VARS']['LOG']['In2code']['In2publishCore'] = [
'writerConfiguration' => [
$logLevel => [
DatabaseWriter::class => [
'logTable' => 'tx_in2publishcore_log',
],
],
],
'processorConfiguration' => [
$logLevel => [
BackendUserProcessor::class => [],
PublishingFailureCollector::class => [],
],
],
];
/******************************************** Configure Compare Plugin ********************************************/
ExtensionUtility::configurePlugin(
'in2publish_core',
'Pi1',
[FrontendController::class => 'preview'],
[FrontendController::class => 'preview'],
);
/******************************************** Configure Garbage Collector ****************************************/
// Register table tx_in2publishcore_running_request in table garbage collector
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][TableGarbageCollectionTask::class]['options']['tables']['tx_in2publishcore_running_request'] = [
'dateField' => 'timestamp_begin',
'expirePeriod' => 1,
];
/*********************************************** Enable PageTSProvider *******************************************/
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['postUserLookUp'][1699367499] = PageTsProvider::class . '->processData';
})();