Skip to content

Commit

Permalink
repair: auto-fix system config types (#1168)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed May 3, 2024
1 parent f51c08d commit 967c62c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion lib/Migration/Repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ public function getName(): string

public function run(IOutput $output): void
{
// Add missing indices
AddMissingIndices::run($output);
$this->configureBinExt($output);
$this->fixSystemConfigTypes($output);
}

public function configureBinExt(IOutput $output): void
{
// kill any instances of go-vod and exiftool
BinExt::pkill(BinExt::getName('go-vod'));
BinExt::pkill(BinExt::getName('exiftool'));
Expand All @@ -49,4 +53,21 @@ public function run(IOutput $output): void
$output->warning('ffmpeg binary could not be configured');
}
}

public function fixSystemConfigTypes(IOutput $output): void
{
// https://github.com/pulsejet/memories/issues/1168
$intKeys = [
'preview_max_x',
'preview_max_y',
'jpeg_quality',
];
foreach ($intKeys as $key) {
$value = $this->config->getSystemValue($key, null);
if (null !== $value && !\is_int($value)) {
$output->info("Fixing system config value for {$key}");
$this->config->setSystemValue($key, (int) $value ?: 2048);
}
}
}
}

0 comments on commit 967c62c

Please sign in to comment.