-
Notifications
You must be signed in to change notification settings - Fork 17
/
ext_localconf.php
64 lines (56 loc) · 2.17 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
<?php
use Doctrine\Common\Annotations\AnnotationReader;
use Aoe\Restler\System\Restler\Configuration;
use Aoe\Restler\System\TYPO3\RestlerEnhancer;
use TYPO3\CMS\Core\Cache\Frontend\VariableFrontend;
use TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend;
use TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend;
defined('TYPO3') or die();
// base restler annotations
$restlerAnnotations = ['url',
'access',
'smart-auto-routing',
'class',
'cache',
'expires',
'throttle',
'status',
'header',
'param',
'throws',
'return',
'var',
'format',
'view',
'errorView'];
foreach ($restlerAnnotations as $ignoreAnnotation) {
AnnotationReader::addGlobalIgnoredName($ignoreAnnotation);
}
// restler plugin annotations
AnnotationReader::addGlobalIgnoredName('restler_typo3cache_expires');
AnnotationReader::addGlobalIgnoredName('restler_typo3cache_tags');
// add restler-configuration-class
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['restler']['restlerConfigurationClasses'][] = Configuration::class;
// add restler page routing
$GLOBALS['TYPO3_CONF_VARS']['SYS']['routing']['enhancers']['Restler'] = RestlerEnhancer::class;
/**
* register cache which can cache response of REST-endpoints
*/
if (false === isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['restler'])) {
// only configure cache, when cache is not already configured (e.g. by any other extension which base on this extension)
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['restler'] = [
'frontend' => VariableFrontend::class,
'backend' => Typo3DatabaseBackend::class,
'options' => ['defaultLifetime' => 0]
];
}
/**
* register cache which will be used from restler (to e.g. cache the routes.php)
*/
if (false === isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_restler_cache'])) {
// only configure cache, when cache is not already configured (e.g. by any other extension which base on this extension)
$GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_restler_cache'] = [
'backend' => SimpleFileBackend::class,
'groups' => ['system']
];
}