|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Analytics |
|
4
|
|
|
* |
|
5
|
|
|
* SPDX-FileCopyrightText: 2019-2022 Marcel Scherello |
|
6
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later |
|
7
|
|
|
*/ |
|
8
|
|
|
|
|
9
|
|
|
namespace OCA\Analytics\Controller; |
|
10
|
|
|
|
|
11
|
|
|
use OCA\Analytics\Service\ThresholdService; |
|
12
|
|
|
use OCP\AppFramework\Controller; |
|
|
|
|
|
|
13
|
|
|
use OCP\IRequest; |
|
|
|
|
|
|
14
|
|
|
use Psr\Log\LoggerInterface; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
class ThresholdController extends Controller |
|
17
|
|
|
{ |
|
18
|
|
|
private $logger; |
|
19
|
|
|
private $ThresholdService; |
|
20
|
|
|
|
|
21
|
|
|
public function __construct( |
|
22
|
|
|
$appName, |
|
23
|
|
|
IRequest $request, |
|
24
|
|
|
LoggerInterface $logger, |
|
25
|
|
|
ThresholdService $ThresholdService |
|
26
|
|
|
) |
|
27
|
|
|
{ |
|
28
|
|
|
parent::__construct($appName, $request); |
|
29
|
|
|
$this->logger = $logger; |
|
30
|
|
|
$this->ThresholdService = $ThresholdService; |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* read all thresholds for a dataset |
|
35
|
|
|
* |
|
36
|
|
|
* @NoAdminRequired |
|
37
|
|
|
* @param int $reportId |
|
38
|
|
|
* @return array |
|
39
|
|
|
*/ |
|
40
|
|
|
public function read(int $reportId) |
|
41
|
|
|
{ |
|
42
|
|
|
return $this->ThresholdService->readRaw($reportId); |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* create new threshold for dataset |
|
47
|
|
|
* |
|
48
|
|
|
* @NoAdminRequired |
|
49
|
|
|
* @param int $reportId |
|
50
|
|
|
* @param $dimension1 |
|
51
|
|
|
* @param $option |
|
52
|
|
|
* @param $value |
|
53
|
|
|
* @param int $severity |
|
54
|
|
|
* @return int |
|
55
|
|
|
*/ |
|
56
|
|
|
public function create(int $reportId, $dimension1, $option, $value, int $severity) |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->ThresholdService->create($reportId, $dimension1, $option, $value, $severity); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Delete threshold for dataset |
|
63
|
|
|
* |
|
64
|
|
|
* @NoAdminRequired |
|
65
|
|
|
* @param int $thresholdId |
|
66
|
|
|
* @return bool |
|
67
|
|
|
*/ |
|
68
|
|
|
public function delete(int $thresholdId) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->ThresholdService->delete($thresholdId); |
|
71
|
|
|
return true; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* validate threshold |
|
76
|
|
|
* |
|
77
|
|
|
* @NoAdminRequired |
|
78
|
|
|
* @param int $reportId |
|
79
|
|
|
* @param $dimension1 |
|
80
|
|
|
* @param $dimension2 |
|
81
|
|
|
* @param $value |
|
82
|
|
|
* @return string |
|
83
|
|
|
* @throws \Exception |
|
84
|
|
|
*/ |
|
85
|
|
|
public function validate(int $reportId, $dimension1, $dimension2, $value) |
|
86
|
|
|
{ |
|
87
|
|
|
return $this->ThresholdService->validate($reportId, $dimension1, $dimension2, $value); |
|
88
|
|
|
} |
|
89
|
|
|
} |
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