1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
|
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* FullTextSearch_Elasticsearch - Use Elasticsearch to index the content of your nextcloud |
7
|
|
|
* |
8
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
9
|
|
|
* later. See the COPYING file. |
10
|
|
|
* |
11
|
|
|
* @author Maxence Lange <[email protected]> |
12
|
|
|
* @copyright 2018 |
13
|
|
|
* @license GNU AGPL version 3 or any later version |
14
|
|
|
* |
15
|
|
|
* This program is free software: you can redistribute it and/or modify |
16
|
|
|
* it under the terms of the GNU Affero General Public License as |
17
|
|
|
* published by the Free Software Foundation, either version 3 of the |
18
|
|
|
* License, or (at your option) any later version. |
19
|
|
|
* |
20
|
|
|
* This program 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 Affero General Public License for more details. |
24
|
|
|
* |
25
|
|
|
* You should have received a copy of the GNU Affero General Public License |
26
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
27
|
|
|
* |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
|
31
|
|
|
namespace OCA\FullTextSearch_Elasticsearch\Settings; |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
use Exception; |
35
|
|
|
use OCA\FullTextSearch_Elasticsearch\AppInfo\Application; |
36
|
|
|
use OCA\FullTextSearch_Elasticsearch\Service\ConfigService; |
37
|
|
|
use OCA\FullTextSearch_Elasticsearch\Service\MiscService; |
38
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
39
|
|
|
use OCP\IL10N; |
40
|
|
|
use OCP\IURLGenerator; |
41
|
|
|
use OCP\Settings\ISettings; |
42
|
|
|
|
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Class Admin |
46
|
|
|
* |
47
|
|
|
* @package OCA\FullTextSearch_Elasticsearch\Settings |
48
|
|
|
*/ |
49
|
|
|
class Admin implements ISettings { |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
/** @var IL10N */ |
53
|
|
|
private $l10n; |
54
|
|
|
|
55
|
|
|
/** @var IURLGenerator */ |
56
|
|
|
private $urlGenerator; |
57
|
|
|
|
58
|
|
|
/** @var ConfigService */ |
59
|
|
|
private $configService; |
60
|
|
|
|
61
|
|
|
/** @var MiscService */ |
62
|
|
|
private $miscService; |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param IL10N $l10n |
67
|
|
|
* @param IURLGenerator $urlGenerator |
68
|
|
|
* @param ConfigService $configService |
69
|
|
|
* @param MiscService $miscService |
70
|
|
|
*/ |
71
|
|
|
public function __construct( |
72
|
|
|
IL10N $l10n, IURLGenerator $urlGenerator, ConfigService $configService, |
73
|
|
|
MiscService $miscService |
74
|
|
|
) { |
75
|
|
|
$this->l10n = $l10n; |
76
|
|
|
$this->urlGenerator = $urlGenerator; |
77
|
|
|
$this->configService = $configService; |
78
|
|
|
$this->miscService = $miscService; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return TemplateResponse |
84
|
|
|
* @throws Exception |
85
|
|
|
*/ |
86
|
|
|
public function getForm(): TemplateResponse { |
87
|
|
|
return new TemplateResponse(Application::APP_NAME, 'settings.admin', []); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return string the section ID, e.g. 'sharing' |
93
|
|
|
*/ |
94
|
|
|
public function getSection(): string { |
95
|
|
|
return 'fulltextsearch'; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return int whether the form should be rather on the top or bottom of |
101
|
|
|
* the admin section. The forms are arranged in ascending order of the |
102
|
|
|
* priority values. It is required to return a value between 0 and 100. |
103
|
|
|
* |
104
|
|
|
* keep the server setting at the top, right after "server settings" |
105
|
|
|
*/ |
106
|
|
|
public function getPriority(): int { |
107
|
|
|
return 31; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
|
111
|
|
|
} |
112
|
|
|
|