1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @copyright Copyright (c) 2016 Arthur Schiwon <[email protected]> |
4
|
|
|
* |
5
|
|
|
* @author Arthur Schiwon <[email protected]> |
6
|
|
|
* @author Christoph Wurst <[email protected]> |
7
|
|
|
* @author Joas Schilling <[email protected]> |
8
|
|
|
* @author Lukas Reschke <[email protected]> |
9
|
|
|
* @author Morris Jobke <[email protected]> |
10
|
|
|
* |
11
|
|
|
* @license GNU AGPL version 3 or any later version |
12
|
|
|
* |
13
|
|
|
* This program is free software: you can redistribute it and/or modify |
14
|
|
|
* it under the terms of the GNU Affero General Public License as |
15
|
|
|
* published by the Free Software Foundation, either version 3 of the |
16
|
|
|
* License, or (at your option) any later version. |
17
|
|
|
* |
18
|
|
|
* This program is distributed in the hope that it will be useful, |
19
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
20
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21
|
|
|
* GNU Affero General Public License for more details. |
22
|
|
|
* |
23
|
|
|
* You should have received a copy of the GNU Affero General Public License |
24
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
25
|
|
|
* |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
namespace OCA\Settings\Settings\Admin; |
29
|
|
|
|
30
|
|
|
use OCP\AppFramework\Http\TemplateResponse; |
31
|
|
|
use OCP\IConfig; |
32
|
|
|
use OCP\Settings\ISettings; |
33
|
|
|
|
34
|
|
|
class Server implements ISettings { |
35
|
|
|
/** @var IConfig */ |
36
|
|
|
private $config; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param IConfig $config |
40
|
|
|
*/ |
41
|
|
|
public function __construct(IConfig $config) { |
42
|
|
|
$this->config = $config; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @return TemplateResponse |
47
|
|
|
*/ |
48
|
|
|
public function getForm() { |
49
|
|
|
$parameters = [ |
50
|
|
|
// Background jobs |
51
|
|
|
'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'), |
52
|
|
|
'lastcron' => $this->config->getAppValue('core', 'lastcron', false), |
|
|
|
|
53
|
|
|
'cronErrors' => $this->config->getAppValue('core', 'cronErrors'), |
54
|
|
|
'cli_based_cron_possible' => function_exists('posix_getpwuid'), |
55
|
|
|
'cli_based_cron_user' => function_exists('posix_getpwuid') ? posix_getpwuid(fileowner(\OC::$configDir . 'config.php'))['name'] : '', |
56
|
|
|
]; |
57
|
|
|
|
58
|
|
|
return new TemplateResponse('settings', 'settings/admin/server', $parameters, ''); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @return string the section ID, e.g. 'sharing' |
63
|
|
|
*/ |
64
|
|
|
public function getSection(): string { |
65
|
|
|
return 'server'; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return int whether the form should be rather on the top or bottom of |
70
|
|
|
* the admin section. The forms are arranged in ascending order of the |
71
|
|
|
* priority values. It is required to return a value between 0 and 100. |
72
|
|
|
* |
73
|
|
|
* E.g.: 70 |
74
|
|
|
*/ |
75
|
|
|
public function getPriority(): int { |
76
|
|
|
return 0; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|