1 | <?php |
||||
2 | use dokuwiki\plugin\struct\meta\AccessTable; |
||||
1 ignored issue
–
show
|
|||||
3 | use dokuwiki\plugin\struct\meta\StructException; |
||||
1 ignored issue
–
show
The type
dokuwiki\plugin\struct\meta\StructException was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
4 | |||||
5 | /** |
||||
6 | * DokuWiki Plugin swarmzapierstructwebhook (Helper Component) |
||||
7 | * |
||||
8 | * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html |
||||
9 | * @author Michael Große <[email protected]> |
||||
10 | */ |
||||
11 | |||||
12 | class helper_plugin_swarmzapierstructwebhook extends DokuWiki_Plugin |
||||
1 ignored issue
–
show
The type
DokuWiki_Plugin was not found. Maybe you did not declare it correctly or list all dependencies?
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. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
13 | { |
||||
14 | |||||
15 | /** |
||||
16 | * Extract the data to be saved from the payload |
||||
17 | * |
||||
18 | * @param array $data |
||||
19 | * |
||||
20 | * @return array |
||||
21 | */ |
||||
22 | public function extractDataFromPayload(array $data) |
||||
23 | { |
||||
24 | $timestamp = $data['createdAt']; |
||||
25 | $checkinID = $data['id']; |
||||
26 | $date = date('Y-m-d', $timestamp); // FIXME: use timezone offset? |
||||
27 | $locationName = $data['venue']['name']; |
||||
28 | |||||
29 | $lookupData = [ |
||||
30 | 'date' => $date, |
||||
31 | 'time' => date_iso8601($timestamp), |
||||
1 ignored issue
–
show
The function
date_iso8601 was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
32 | 'checkinid' => $checkinID, |
||||
33 | 'locname' => $locationName, |
||||
34 | ]; |
||||
35 | if (!empty($data['shout'])) { |
||||
36 | $lookupData['shout'] = $data['shout']; |
||||
37 | } |
||||
38 | return $lookupData; |
||||
39 | } |
||||
40 | |||||
41 | /** |
||||
42 | * @param array $data associative array in the form of [columnname => columnvalue] |
||||
43 | */ |
||||
44 | public function saveDataToLookup(array $data) |
||||
45 | { |
||||
46 | $access = AccessTable::byTableName('swarm', 0, 0); |
||||
47 | if (!$access->getSchema()->isEditable()) { |
||||
48 | throw new StructException('lookup save error: no permission for schema'); |
||||
49 | } |
||||
50 | $validator = $access->getValidator($data); |
||||
51 | if (!$validator->validate()) { |
||||
52 | throw new StructException("Validation failed:\n%s", implode("\n", $validator->getErrors())); |
||||
53 | } |
||||
54 | if (!$validator->saveData()) { |
||||
55 | throw new StructException('No data saved'); |
||||
56 | } |
||||
57 | } |
||||
58 | |||||
59 | /** |
||||
60 | * Deletes a checkin from the lookup |
||||
61 | * |
||||
62 | * @param string $checkinid |
||||
63 | */ |
||||
64 | public function deleteCheckinFromLookup($checkinid) |
||||
65 | { |
||||
66 | $tablename = 'swarm'; |
||||
67 | |||||
68 | /** @var remote_plugin_struct $remote */ |
||||
69 | $remote = plugin_load('remote', 'struct'); |
||||
1 ignored issue
–
show
The function
plugin_load was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
70 | $rows = $remote->getAggregationData( |
||||
71 | [$tablename], |
||||
72 | ['%rowid%'], |
||||
73 | [['logic'=> 'and', 'condition' => "checkinid = $checkinid"]] |
||||
74 | ); |
||||
75 | |||||
76 | $pids = array_column($rows, '%rowid%'); |
||||
77 | |||||
78 | if (empty($pids)) { |
||||
79 | return; |
||||
80 | } |
||||
81 | foreach ($pids as $pid) { // should only be a single entry |
||||
82 | $schemadata = AccessTable::byTableName($tablename, $pid); |
||||
83 | if (!$schemadata->getSchema()->isEditable()) { |
||||
84 | throw new StructException('lookup delete error: no permission for schema'); |
||||
85 | } |
||||
86 | $schemadata->clearData(); |
||||
87 | } |
||||
88 | } |
||||
89 | } |
||||
90 |
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