1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\Module\logpeek\Config; |
6
|
|
|
|
7
|
|
|
use E_USER_NOTICE; |
|
|
|
|
8
|
|
|
use SimpleSAML\Assert\Assert; |
9
|
|
|
use SimpleSAML\Configuration; |
10
|
|
|
use SimpleSAML\Utils; |
11
|
|
|
use Symfony\Component\Yaml\Yaml; |
12
|
|
|
use Symfony\Component\Yaml\Exception\ParseException; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Configuration for the module logpeek. |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
class Logpeek { |
19
|
|
|
/** @var int */ |
20
|
|
|
public const MAX_BLOCKSIZE = 8192; |
21
|
|
|
|
22
|
|
|
/** @var int */ |
23
|
|
|
public const DEFAULT_BLOCKSIZE = 8192; |
24
|
|
|
|
25
|
|
|
/** @var int */ |
26
|
|
|
public const DEFAULT_LINES = 500; |
27
|
|
|
|
28
|
|
|
/** @var string */ |
29
|
|
|
private string $logFile; |
30
|
|
|
|
31
|
|
|
/** @var int */ |
32
|
|
|
private int $lines = self::DEFAULT_LINES; |
33
|
|
|
|
34
|
|
|
/** @var int */ |
35
|
|
|
private int $blockSize = self::DEFAULT_BLOCKSIZE; |
36
|
|
|
|
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param string $defaultConfigFile |
40
|
|
|
* @throws \Symfony\Component\Yaml\Exception\ParseException |
41
|
|
|
*/ |
42
|
|
|
public function __construct(string $defaultConfigFile = 'module_logpeek.yml') |
43
|
|
|
{ |
44
|
|
|
$configUtils = new Utils\Config(); |
45
|
|
|
$configDir = $configUtils->getConfigDir(); |
46
|
|
|
$yamlConfig = Yaml::parse(file_get_contents($configDir . '/' . $defaultConfigFile)) ?? []; |
47
|
|
|
if (isset($yamlConfig['logFile'])) { |
48
|
|
|
$this->setLogfile($yamlConfig['logFile']); |
49
|
|
|
} else { |
50
|
|
|
$config = Configuration::getInstance(); |
51
|
|
|
$loggingDir = $config->getPathValue('loggingdir', 'log/'); |
52
|
|
|
$this->setLogfile($loggingDir . $config->getString('logging.logfile', 'simplesamlphp.log')); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
if (isset($yamlConfig['lines'])) { |
56
|
|
|
$this->setLines($yamlConfig['lines']); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
if (isset($yamlConfig['blockSize'])) { |
60
|
|
|
$this->setBlockSize($yamlConfig['blockSize']); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return string |
67
|
|
|
*/ |
68
|
|
|
public function getLogFile(): string { |
69
|
|
|
return $this->logFile; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param string $logFile |
75
|
|
|
* @return void |
76
|
|
|
*/ |
77
|
|
|
protected function setLogFile(string $logFile): void { |
78
|
|
|
$this->logFile = $logFile; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return int |
84
|
|
|
*/ |
85
|
|
|
public function getLines(): int { |
86
|
|
|
return $this->lines; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param int $lines |
92
|
|
|
* @return void |
93
|
|
|
*/ |
94
|
|
|
protected function setLines(int $lines): void { |
95
|
|
|
Assert::positiveInteger($lines); |
96
|
|
|
$this->lines = $lines; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return int |
102
|
|
|
*/ |
103
|
|
|
public function getBlockSize(): int { |
104
|
|
|
return $this->blockSize; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param int $blockSize |
110
|
|
|
* @return void |
111
|
|
|
*/ |
112
|
|
|
protected function setBlockSize(int $blockSize): void { |
113
|
|
|
Assert::range($blockSize, 0, self::MAX_BLOCKSIZE); |
114
|
|
|
$this->blockSize = $blockSize; |
115
|
|
|
} |
116
|
|
|
}; |
117
|
|
|
|
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