Failed Conditions
Push — master ( 97e960...0b92b6 )
by Timo
23:14
created

OverriddenTypoScriptFrontendController   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 37.5%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 31
ccs 3
cts 8
cp 0.375
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A pageUnavailableAndExit() 0 6 2
A pageNotFoundAndExit() 0 6 2
1
<?php
2
namespace ApacheSolrForTypo3\Solr\System\Mvc\Frontend\Controller;
3
4
/***************************************************************
5
 *  Copyright notice
6
 *
7
 *  (c) 2010-2017 dkd Internet Service GmbH <[email protected]>
8
 *  All rights reserved
9
 *
10
 *  This script is part of the TYPO3 project. The TYPO3 project is
11
 *  free software; you can redistribute it and/or modify
12
 *  it under the terms of the GNU General Public License as published by
13
 *  the Free Software Foundation; either version 3 of the License, or
14
 *  (at your option) any later version.
15
 *
16
 *  The GNU General Public License can be found at
17
 *  http://www.gnu.org/copyleft/gpl.html.
18
 *
19
 *  This script is distributed in the hope that it will be useful,
20
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 *  GNU General Public License for more details.
23
 *
24
 *  This copyright notice MUST APPEAR in all copies of the script!
25
 ***************************************************************/
26
27
use ApacheSolrForTypo3\Solr\IndexQueue\Exception\DocumentPreparationException;
28
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
29
30
/**
31
 * Overrides TYPO3 CMS TypoScriptFrontendController TSFE to prevent PHP on indexing processes from dieing.
32
 */
33
class OverriddenTypoScriptFrontendController extends TypoScriptFrontendController
34
{
35
36
    /**
37
     * Page unavailable handler for use in frontend plugins from extensions.
38
     *
39
     * @param string $reason Reason text
40
     * @param string $header HTTP header to send
41
     * @throws DocumentPreparationException
42
     */
43
    public function pageUnavailableAndExit($reason = '', $header = '')
44
    {
45
        if (!defined('EXT_SOLR_INDEXING_CONTEXT')) {
46
            parent::pageUnavailableAndExit($reason = '', $header = '');
47
        }
48
        throw new DocumentPreparationException('Solr Document can not be prepared. The Reason: ' . $reason, 1517584040);
49
    }
50
51
    /**
52
     * Page-not-found handler for use in frontend plugins from extensions.
53
     *
54
     * @param string $reason Reason text
55
     * @param string $header HTTP header to send
56
     * @throws DocumentPreparationException
57
     */
58 1
    public function pageNotFoundAndExit($reason = '', $header = '')
59
    {
60 1
        if (!defined('EXT_SOLR_INDEXING_CONTEXT')) {
61
            parent::pageNotFoundAndExit($reason = '', $header = '');
62
        }
63 1
        throw new DocumentPreparationException('Solr Document can not be prepared. The Reason: ' . $reason, 1517584045);
64
    }
65
66
}