|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
/** |
|
4
|
|
|
* Data Analytics |
|
5
|
|
|
* |
|
6
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
7
|
|
|
* later. See the LICENSE.md file. |
|
8
|
|
|
* |
|
9
|
|
|
* @author Marcel Scherello <[email protected]> |
|
10
|
|
|
* @copyright 2019 Marcel Scherello |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace OCA\Analytics\Flow; |
|
14
|
|
|
|
|
15
|
|
|
use OCP\EventDispatcher\Event; |
|
16
|
|
|
use OCP\EventDispatcher\IEventDispatcher; |
|
17
|
|
|
use OCP\ILogger; |
|
18
|
|
|
use OCP\Util; |
|
19
|
|
|
use OCP\WorkflowEngine\EntityContext\IDisplayText; |
|
|
|
|
|
|
20
|
|
|
use OCP\WorkflowEngine\EntityContext\IUrl; |
|
|
|
|
|
|
21
|
|
|
use OCP\WorkflowEngine\IEntity; |
|
|
|
|
|
|
22
|
|
|
use OCP\WorkflowEngine\IManager as FlowManager; |
|
23
|
|
|
use OCP\WorkflowEngine\IOperation; |
|
24
|
|
|
use OCP\WorkflowEngine\IRuleMatcher; |
|
|
|
|
|
|
25
|
|
|
use Symfony\Component\EventDispatcher\GenericEvent; |
|
26
|
|
|
use UnexpectedValueException; |
|
27
|
|
|
|
|
28
|
|
|
class Operation implements IOperation |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
private $logger; |
|
32
|
|
|
|
|
33
|
|
|
public function __construct( |
|
34
|
|
|
ILogger $logger |
|
35
|
|
|
) |
|
36
|
|
|
{ |
|
37
|
|
|
$this->logger = $logger; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public static function register(IEventDispatcher $dispatcher): void |
|
41
|
|
|
{ |
|
42
|
|
|
$dispatcher->addListener(FlowManager::EVENT_NAME_REG_OPERATION, function (GenericEvent $event) { |
|
|
|
|
|
|
43
|
|
|
$operation = \OC::$server->query(Operation::class); |
|
44
|
|
|
$event->getSubject()->registerOperation($operation); |
|
45
|
|
|
Util::addScript('analytics', 'flow'); |
|
46
|
|
|
}); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
public function getDisplayName(): string |
|
50
|
|
|
{ |
|
51
|
|
|
return $this->l->t('Write to Analytics'); |
|
|
|
|
|
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
public function getDescription(): string |
|
55
|
|
|
{ |
|
56
|
|
|
return $this->l->t('Writes data to report'); |
|
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
public function getIcon(): string |
|
60
|
|
|
{ |
|
61
|
|
|
return $this->urlGenerator->imagePath('analytics', 'app.svg'); |
|
|
|
|
|
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function isAvailableForScope(int $scope): bool |
|
|
|
|
|
|
65
|
|
|
{ |
|
66
|
|
|
return true; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Validates whether a configured workflow rule is valid. If it is not, |
|
71
|
|
|
* an `\UnexpectedValueException` is supposed to be thrown. |
|
72
|
|
|
* |
|
73
|
|
|
* @throws UnexpectedValueException |
|
74
|
|
|
* @since 9.1 |
|
75
|
|
|
*/ |
|
76
|
|
|
public function validateOperation($name, array $checks, $operation): void |
|
77
|
|
|
{ |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
public function onEvent(string $eventName, Event $event, IRuleMatcher $ruleMatcher): void |
|
|
|
|
|
|
81
|
|
|
{ |
|
82
|
|
|
$this->logger->debug("Test Flow Operation"); |
|
83
|
|
|
} |
|
84
|
|
|
} |
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