|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
|
|
4
|
|
|
/** |
|
5
|
|
|
* Files_FromMail - Recover your email attachments from your cloud. |
|
6
|
|
|
* |
|
7
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
8
|
|
|
* later. See the COPYING file. |
|
9
|
|
|
* |
|
10
|
|
|
* @author Maxence Lange <[email protected]> |
|
11
|
|
|
* @copyright 2017 |
|
12
|
|
|
* @license GNU AGPL version 3 or any later version |
|
13
|
|
|
* |
|
14
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
15
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
16
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
17
|
|
|
* License, or (at your option) any later version. |
|
18
|
|
|
* |
|
19
|
|
|
* This program 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 Affero General Public License for more details. |
|
23
|
|
|
* |
|
24
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
25
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
26
|
|
|
* |
|
27
|
|
|
*/ |
|
28
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
namespace OCA\Files_FromMail\Service; |
|
31
|
|
|
|
|
32
|
|
|
use OCP\IConfig; |
|
|
|
|
|
|
33
|
|
|
use OCP\IRequest; |
|
|
|
|
|
|
34
|
|
|
|
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Class ConfigService |
|
38
|
|
|
* |
|
39
|
|
|
* @package OCA\Files_FromMail\Service |
|
40
|
|
|
*/ |
|
41
|
|
|
class ConfigService { |
|
42
|
|
|
|
|
43
|
|
|
const FROMMAIL_ADDRESSES = 'frommail_addresses'; |
|
44
|
|
|
const FROMMAIL_FILENAMEID = 'filename_id'; |
|
45
|
|
|
|
|
46
|
|
|
private $defaults = [ |
|
47
|
|
|
self::FROMMAIL_ADDRESSES => '', |
|
48
|
|
|
self::FROMMAIL_FILENAMEID => 'Y-m-d H:i:s', |
|
49
|
|
|
]; |
|
50
|
|
|
|
|
51
|
|
|
|
|
52
|
|
|
/** @var string */ |
|
53
|
|
|
private $appName; |
|
54
|
|
|
|
|
55
|
|
|
/** @var IConfig */ |
|
56
|
|
|
private $config; |
|
57
|
|
|
|
|
58
|
|
|
/** @var string */ |
|
59
|
|
|
private $userId; |
|
60
|
|
|
|
|
61
|
|
|
/** @var IRequest */ |
|
62
|
|
|
private $request; |
|
63
|
|
|
|
|
64
|
|
|
/** @var MiscService */ |
|
65
|
|
|
private $miscService; |
|
66
|
|
|
|
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* ConfigService constructor. |
|
70
|
|
|
* |
|
71
|
|
|
* @param string $appName |
|
72
|
|
|
* @param IConfig $config |
|
73
|
|
|
* @param IRequest $request |
|
74
|
|
|
* @param string $userId |
|
75
|
|
|
* @param MiscService $miscService |
|
76
|
|
|
*/ |
|
77
|
|
|
public function __construct( |
|
78
|
|
|
$appName, IConfig $config, IRequest $request, $userId, MiscService $miscService |
|
79
|
|
|
) { |
|
80
|
|
|
$this->appName = $appName; |
|
81
|
|
|
$this->config = $config; |
|
82
|
|
|
$this->request = $request; |
|
83
|
|
|
$this->userId = $userId; |
|
84
|
|
|
$this->miscService = $miscService; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Get a value by key |
|
90
|
|
|
* |
|
91
|
|
|
* @param string $key |
|
92
|
|
|
* |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getAppValue(string $key): string { |
|
96
|
|
|
$defaultValue = null; |
|
97
|
|
|
|
|
98
|
|
|
if (array_key_exists($key, $this->defaults)) { |
|
99
|
|
|
$defaultValue = $this->defaults[$key]; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
return $this->config->getAppValue($this->appName, $key, $defaultValue); |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Set a value by key |
|
108
|
|
|
* |
|
109
|
|
|
* @param string $key |
|
110
|
|
|
* @param string $value |
|
111
|
|
|
*/ |
|
112
|
|
|
public function setAppValue(string $key, string $value): void { |
|
113
|
|
|
$this->config->setAppValue($this->appName, $key, $value); |
|
114
|
|
|
} |
|
115
|
|
|
|
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* remove a key |
|
119
|
|
|
* |
|
120
|
|
|
* @param string $key |
|
121
|
|
|
* |
|
122
|
|
|
* @return string |
|
123
|
|
|
*/ |
|
124
|
|
|
public function deleteAppValue(string $key): string { |
|
125
|
|
|
return $this->config->deleteAppValue($this->appName, $key); |
|
126
|
|
|
} |
|
127
|
|
|
|
|
128
|
|
|
} |
|
129
|
|
|
|
|
130
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths