-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathconfig.php
90 lines (83 loc) · 3.01 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/**
* @author Andreas Fischer <[email protected]>
* @author Bart Visscher <[email protected]>
* @author Frank Karlitschek <[email protected]>
* @author Joas Schilling <[email protected]>
* @author Lukas Reschke <[email protected]>
* @author Morris Jobke <[email protected]>
* @author Philipp Kapfer <[email protected]>
* @author Robin Appelman <[email protected]>
* @author Robin McCorkell <[email protected]>
* @author Thomas Müller <[email protected]>
* @author Vincent Petry <[email protected]>
*
* @copyright Copyright (c) 2018, ownCloud GmbH
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
use OCA\Files_External\AppInfo\Application;
use OCP\Files\External\Backend\Backend;
/**
* Class to configure mount.json globally and for users
*/
class OC_Mount_Config extends \OC\Files\External\LegacyUtil {
/** @var Application */
public static $app;
/**
* Get backend dependency message
* TODO: move into AppFramework along with templates
*
* @param Backend[] $backends
* @return string
*/
public static function dependencyMessage($backends) {
$l = \OC::$server->getL10N('files_external');
$message = '';
$dependencyGroups = [];
foreach ($backends as $backend) {
foreach ($backend->checkDependencies() as $dependency) {
if ($message = $dependency->getMessage()) {
$message .= '<br />' . $l->t('<b>Note:</b> ') . $message;
} else {
$dependencyGroups[$dependency->getDependency()][] = $backend;
}
}
}
foreach ($dependencyGroups as $module => $dependants) {
$backends = \implode(', ', \array_map(function ($backend) {
return '<i>' . $backend->getText() . '</i>';
}, $dependants));
$message .= '<br />' . OC_Mount_Config::getSingleDependencyMessage($l, $module, $backends);
}
return $message;
}
/**
* Returns a dependency missing message
*
* @param \OCP\IL10N $l
* @param string $module
* @param string $backend
* @return string
*/
private static function getSingleDependencyMessage(\OCP\IL10N $l, $module, $backend) {
switch (\strtolower($module)) {
case 'curl':
return (string)$l->t('<b>Note:</b> The cURL support in PHP is not enabled or installed. Mounting of %s is not possible. Please ask your system administrator to install it.', $backend);
default:
return (string)$l->t('<b>Note:</b> "%s" is not installed. Mounting of %s is not possible. Please ask your system administrator to install it.', [$module, $backend]);
}
}
}