1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* (c) Kitodo. Key to digital objects e.V. <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This file is part of the Kitodo and TYPO3 projects. |
7
|
|
|
* |
8
|
|
|
* @license GNU General Public License version 3 or later. |
9
|
|
|
* For the full copyright and license information, please read the |
10
|
|
|
* LICENSE.txt file that was distributed with this source code. |
11
|
|
|
*/ |
12
|
|
|
|
13
|
|
|
namespace Kitodo\Dlf\Hooks; |
14
|
|
|
|
15
|
|
|
use Kitodo\Dlf\Common\Helper; |
16
|
|
|
use Kitodo\Dlf\Common\Solr; |
17
|
|
|
use TYPO3\CMS\Core\Core\Bootstrap; |
18
|
|
|
use TYPO3\CMS\Core\Database\ConnectionPool; |
19
|
|
|
use TYPO3\CMS\Core\Localization\LanguageService; |
20
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
21
|
|
|
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; |
22
|
|
|
use TYPO3\CMS\Core\Utility\VersionNumberUtility; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Hooks and helper for \TYPO3\CMS\Core\TypoScript\ConfigurationForm |
26
|
|
|
* |
27
|
|
|
* @author Sebastian Meyer <[email protected]> |
28
|
|
|
* @package TYPO3 |
29
|
|
|
* @subpackage dlf |
30
|
|
|
* @access public |
31
|
|
|
*/ |
32
|
|
|
class ConfigurationForm |
33
|
|
|
{ |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Check if a connection to a Solr server could be established with the given credentials. |
37
|
|
|
* |
38
|
|
|
* @access public |
39
|
|
|
* |
40
|
|
|
* @return string Message informing the user of success or failure |
41
|
|
|
*/ |
42
|
|
|
public function checkSolrConnection() |
43
|
|
|
{ |
44
|
|
|
$solr = Solr::getInstance(); |
45
|
|
|
if ($solr->ready) { |
46
|
|
|
Helper::addMessage( |
47
|
|
|
Helper::getLanguageService()->getLL('solr.status'), |
48
|
|
|
Helper::getLanguageService()->getLL('solr.connected'), |
49
|
|
|
\TYPO3\CMS\Core\Messaging\FlashMessage::OK |
50
|
|
|
); |
51
|
|
|
} else { |
52
|
|
|
Helper::addMessage( |
53
|
|
|
Helper::getLanguageService()->getLL('solr.error'), |
54
|
|
|
Helper::getLanguageService()->getLL('solr.notConnected'), |
55
|
|
|
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING |
56
|
|
|
); |
57
|
|
|
} |
58
|
|
|
return Helper::renderFlashMessages(); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* This is the constructor. |
63
|
|
|
* |
64
|
|
|
* @access public |
65
|
|
|
* |
66
|
|
|
* @return void |
67
|
|
|
*/ |
68
|
|
|
public function __construct() |
69
|
|
|
{ |
70
|
|
|
// Load backend localization file. |
71
|
|
|
Helper::getLanguageService()->includeLLFile('EXT:dlf/Resources/Private/Language/locallang_be.xlf'); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
} |
75
|
|
|
|