mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-28 06:20:14 +00:00
Add missing type definitions for psalm
Signed-off-by: Simon L. <szaimen@e.mail.de>
This commit is contained in:
@@ -288,6 +288,7 @@ class ConfigurationManager
|
||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||
{
|
||||
$configContent = (string)file_get_contents(DataConst::GetConfigFile());
|
||||
/** @var array */
|
||||
$this->config = json_decode($configContent, true, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
@@ -332,6 +333,7 @@ class ConfigurationManager
|
||||
return '';
|
||||
}
|
||||
|
||||
/** @var array */
|
||||
$secrets = $this->get('secrets', []);
|
||||
if (!isset($secrets[$secretId])) {
|
||||
$secrets[$secretId] = bin2hex(random_bytes(24));
|
||||
@@ -466,15 +468,17 @@ class ConfigurationManager
|
||||
if ($this->shouldDomainValidationBeSkipped($skipDomainValidation)) {
|
||||
error_log('Skipping domain validation');
|
||||
} else {
|
||||
/** @var string */
|
||||
$dnsRecordIP = gethostbyname($domain);
|
||||
if ($dnsRecordIP === $domain) {
|
||||
$dnsRecordIP = '';
|
||||
}
|
||||
|
||||
if (empty($dnsRecordIP)) {
|
||||
/** @var array */
|
||||
$record = dns_get_record($domain, DNS_AAAA);
|
||||
if (isset($record[0]['ipv6']) && !empty($record[0]['ipv6'])) {
|
||||
$dnsRecordIP = $record[0]['ipv6'];
|
||||
$dnsRecordIP = (string) $record[0]['ipv6'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,6 +698,7 @@ class ConfigurationManager
|
||||
|
||||
private function getEnvironmentalVariableOrConfig(string $envVariableName, string $configName, string $defaultValue) : string {
|
||||
$envVariableOutput = getenv($envVariableName);
|
||||
/** @var mixed */
|
||||
$configValue = $this->get($configName, '');
|
||||
if ($envVariableOutput === false) {
|
||||
if ($configValue === '') {
|
||||
@@ -919,6 +924,7 @@ class ConfigurationManager
|
||||
$dir = array_diff($dir, array('..', '.', 'readme.md'));
|
||||
foreach ($dir as $id) {
|
||||
$filePath = DataConst::GetCommunityContainersDirectory() . '/' . $id . '/' . $id . '.json';
|
||||
/** @psalm-var mixed $fileContents */
|
||||
$fileContents = apcu_fetch($filePath);
|
||||
if (!is_string($fileContents)) {
|
||||
$fileContents = file_get_contents($filePath);
|
||||
@@ -926,8 +932,11 @@ class ConfigurationManager
|
||||
apcu_add($filePath, $fileContents);
|
||||
}
|
||||
}
|
||||
|
||||
/** @psalm-var array $json */
|
||||
$json = is_string($fileContents) ? json_decode($fileContents, true, 512, JSON_THROW_ON_ERROR) : false;
|
||||
if(is_array($json) && is_array($json['aio_services_v1'])) {
|
||||
if(isset($json['aio_services_v1']) && is_array($json['aio_services_v1'])) {
|
||||
/** @psalm-var array $service */
|
||||
foreach ($json['aio_services_v1'] as $service) {
|
||||
$documentation = is_string($service['documentation']) ? $service['documentation'] : '';
|
||||
if (is_string($service['display_name'])) {
|
||||
@@ -960,8 +969,9 @@ class ConfigurationManager
|
||||
return;
|
||||
}
|
||||
$this->startTransaction();
|
||||
/** @psalm-var string $variable */
|
||||
foreach ($input as $variable) {
|
||||
if (!is_string($variable) || !str_contains($variable, '=')) {
|
||||
if (!str_contains($variable, '=')) {
|
||||
error_log("Invalid input: '$variable' is not a string or does not contain an equal sign ('=')");
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user