Completed
Branch master (b7ffcb)
by Tomas Norre
17:57
created

HookUtility   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A registerHooks() 0 23 1
1
<?php
2
namespace AOE\Crawler\Utility;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2016 AOE GmbH <[email protected]>
8
 *
9
 *  All rights reserved
10
 *
11
 *  This script is part of the TYPO3 project. The TYPO3 project is
12
 *  free software; you can redistribute it and/or modify
13
 *  it under the terms of the GNU General Public License as published by
14
 *  the Free Software Foundation; either version 3 of the License, or
15
 *  (at your option) any later version.
16
 *
17
 *  The GNU General Public License can be found at
18
 *  http://www.gnu.org/copyleft/gpl.html.
19
 *
20
 *  This script is distributed in the hope that it will be useful,
21
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
22
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
 *  GNU General Public License for more details.
24
 *
25
 *  This copyright notice MUST APPEAR in all copies of the script!
26
 ***************************************************************/
27
28
use AOE\Crawler\Hooks\ProcessCleanUpHook;
29
use AOE\Crawler\Hooks\StaticFileCacheCreateUriHook;
30
use AOE\Crawler\Hooks\TsfeHook;
31
32
/**
33
 * Class HookUtility
34
 *
35
 * @package AOE\Crawler\Utility
36
 *
37
 * @codeCoverageIgnore
38
 */
39
class HookUtility
40
{
41
42
    /**
43
     * Registers hooks
44
     *
45
     * @param string $extKey
46
     */
47
    public static function registerHooks($extKey)
48
    {
49
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['connectToDB']['tx_crawler'] =
50
            TsfeHook::class . '->fe_init';
51
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['initFEuser']['tx_crawler'] =
52
            TsfeHook::class . '->fe_feuserInit';
53
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['isOutputting']['tx_crawler'] =
54
            TsfeHook::class . '->fe_isOutputting';
55
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tslib/class.tslib_fe.php']['hook_eofe']['tx_crawler'] =
56
            TsfeHook::class . '->fe_eofe';
57
58
        // Activating NC Static File Cache hook
59
        $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['nc_staticfilecache/class.tx_ncstaticfilecache.php']['createFile_initializeVariables']['tx_crawler'] =
60
            StaticFileCacheCreateUriHook::class . '->initialize';
61
62
        // Activating Crawler cli_hooks
63
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['cli_hooks'][] =
64
            ProcessCleanUpHook::class;
65
66
        // Activating refresh hooks
67
        $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$extKey]['refresh_hooks'][] =
68
            ProcessCleanUpHook::class;
69
    }
70
}
71