1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SSpkS\Handler; |
4
|
|
|
|
5
|
|
|
use \SSpkS\Output\JsonOutput; |
|
|
|
|
6
|
|
|
use \SSpkS\Output\UrlFixer; |
|
|
|
|
7
|
|
|
use \SSpkS\Package\PackageFinder; |
|
|
|
|
8
|
|
|
use \SSpkS\Package\PackageFilter; |
|
|
|
|
9
|
|
|
|
10
|
|
|
/* |
11
|
|
|
example data passed by a syno |
12
|
|
|
|
13
|
|
|
language = enu |
14
|
|
|
timezone = Brussels |
15
|
|
|
unique = synology_cedarview_412 |
16
|
|
|
arch = cedarview |
17
|
|
|
major = 4 |
18
|
|
|
minor = 1 |
19
|
|
|
build = 2636 |
20
|
|
|
package_update_channel = stable |
21
|
|
|
|
22
|
|
|
[package_update_channel] => beta |
23
|
|
|
[unique] => synology_avoton_415+ |
24
|
|
|
[build] => 7393 |
25
|
|
|
[language] => enu |
26
|
|
|
[major] => 6 |
27
|
|
|
[arch] => avoton |
28
|
|
|
[minor] => 0 |
29
|
|
|
[timezone] => Amsterdam |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
class SynologyHandler extends AbstractHandler |
33
|
|
|
{ |
34
|
|
|
public function canHandle() |
35
|
|
|
{ |
36
|
|
|
return (isset($_REQUEST['unique']) && substr($_REQUEST['unique'], 0, 8) == 'synology'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function handle() |
40
|
|
|
{ |
41
|
|
|
// Synology request --> show JSON |
42
|
|
|
$arch = trim($_REQUEST['arch']); |
43
|
|
|
$major = trim($_REQUEST['major']); |
44
|
|
|
$minor = trim($_REQUEST['minor']); |
45
|
|
|
$build = trim($_REQUEST['build']); |
46
|
|
|
$channel = trim($_REQUEST['package_update_channel']); |
47
|
|
|
if (isset($_REQUEST['language'])) { |
48
|
|
|
$language = trim($_REQUEST['language']); |
49
|
|
|
} else { |
50
|
|
|
$language = ''; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
// more parameters: timezone and unique |
54
|
|
|
|
55
|
|
|
// Make sure, that the "client" knows that output is sent in JSON format |
56
|
|
|
header('Content-type: application/json'); |
57
|
|
|
$fw_version = $major . '.' . $minor . '.' . $build; |
58
|
|
|
$pkgs = new PackageFinder($this->config); |
59
|
|
|
$pkgf = new PackageFilter($this->config, $pkgs->getAllPackages()); |
60
|
|
|
$pkgf->setArchitectureFilter($arch); |
61
|
|
|
$pkgf->setChannelFilter($channel); |
62
|
|
|
$pkgf->setFirmwareVersionFilter($fw_version); |
63
|
|
|
$pkgf->setOldVersionFilter(true); |
64
|
|
|
$filteredPkgList = $pkgf->getFilteredPackageList(); |
65
|
|
|
|
66
|
|
|
$uf = new UrlFixer($this->config->baseUrl); |
67
|
|
|
$uf->fixPackageList($filteredPkgList); |
68
|
|
|
|
69
|
|
|
$jo = new JsonOutput($this->config); |
70
|
|
|
$jo->setExcludedServices($this->config->excludedSynoServices); |
71
|
|
|
$hideKeys = array(); |
72
|
|
|
if ($major >= 7) { |
73
|
|
|
// DSM7 does always hides packages marked as beta |
74
|
|
|
array_push($hideKeys, 'beta'); |
75
|
|
|
} |
76
|
|
|
$jo->outputPackages($filteredPkgList, $language, $hideKeys); |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|
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