1
|
|
|
<?php |
2
|
|
|
use dokuwiki\plugin\struct\meta\AccessTable; |
|
|
|
|
3
|
|
|
use dokuwiki\plugin\struct\meta\StructException; |
|
|
|
|
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 |
|
|
|
|
13
|
|
|
{ |
14
|
|
|
/** |
15
|
|
|
* @param array $data associative array in the form of [columnname => columnvalue] |
16
|
|
|
*/ |
17
|
|
|
public function saveDataToLookup(array $data) |
18
|
|
|
{ |
19
|
|
|
$access = AccessTable::byTableName('swarm', 0, 0); |
20
|
|
|
if (!$access->getSchema()->isEditable()) { |
21
|
|
|
throw new StructException('lookup save error: no permission for schema'); |
22
|
|
|
} |
23
|
|
|
$validator = $access->getValidator($data); |
24
|
|
|
if (!$validator->validate()) { |
25
|
|
|
throw new StructException("Validation failed:\n%s", implode("\n", $validator->getErrors())); |
26
|
|
|
} |
27
|
|
|
if (!$validator->saveData()) { |
28
|
|
|
throw new StructException('No data saved'); |
29
|
|
|
} |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Deletes a checkin from the lookup |
34
|
|
|
* |
35
|
|
|
* @param string $checkinid |
36
|
|
|
*/ |
37
|
|
|
public function deleteCheckinFromLookup($checkinid) |
38
|
|
|
{ |
39
|
|
|
$tablename = 'swarm'; |
40
|
|
|
|
41
|
|
|
/** @var remote_plugin_struct $remote */ |
42
|
|
|
$remote = plugin_load('remote', 'struct'); |
|
|
|
|
43
|
|
|
$rows = $remote->getAggregationData( |
44
|
|
|
[$tablename], |
45
|
|
|
['%rowid%'], |
46
|
|
|
[['logic'=> 'and', 'condition' => "checkinid = $checkinid"]] |
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
$pids = array_column($rows, '%rowid%'); |
50
|
|
|
|
51
|
|
|
if (empty($pids)) { |
52
|
|
|
return; |
53
|
|
|
} |
54
|
|
|
foreach ($pids as $pid) { // should only be a single entry |
55
|
|
|
$schemadata = AccessTable::byTableName($tablename, $pid); |
56
|
|
|
if (!$schemadata->getSchema()->isEditable()) { |
57
|
|
|
throw new StructException('lookup delete error: no permission for schema'); |
58
|
|
|
} |
59
|
|
|
$schemadata->clearData(); |
60
|
|
|
} |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
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