diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php index e488b5a8..d4b72cf8 100644 --- a/lib/Controller/AdminController.php +++ b/lib/Controller/AdminController.php @@ -133,7 +133,7 @@ class AdminController extends GenericApiController // Check for FFmpeg for preview generation $status['ffmpeg_preview'] = $this->getExecutableStatus( - Util::getSystemConfig('preview_ffmpeg_path', null, true) + Util::getSystemConfig('preview_ffmpeg_path') ?: trim(shell_exec('which ffmpeg') ?: ''), static fn ($p) => BinExt::testFFmpeg($p, 'ffmpeg'), ); diff --git a/lib/Service/BinExt.php b/lib/Service/BinExt.php index 92bb3e43..502e0283 100644 --- a/lib/Service/BinExt.php +++ b/lib/Service/BinExt.php @@ -165,7 +165,7 @@ class BinExt 'vaapi' => Util::getSystemConfig('memories.vod.vaapi'), 'vaapiLowPower' => Util::getSystemConfig('memories.vod.vaapi.low_power'), - 'nvenc' => Util::getSystemConfig('memories.vod.nvenc', false), + 'nvenc' => Util::getSystemConfig('memories.vod.nvenc'), 'nvencTemporalAQ' => Util::getSystemConfig('memories.vod.nvenc.temporal_aq'), 'nvencScale' => Util::getSystemConfig('memories.vod.nvenc.scale'), diff --git a/lib/SystemConfigDefault.php b/lib/SystemConfigDefault.php index 27a19d3f..331854c3 100644 --- a/lib/SystemConfigDefault.php +++ b/lib/SystemConfigDefault.php @@ -72,4 +72,8 @@ return [ 'preview_max_y' => 4096, 'preview_max_memory' => 128, 'preview_max_filesize_image' => 50, + 'preview_ffmpeg_path' => '', + + // Placeholders only; these are not touched by the app + 'instanceid' => 'default', ]; diff --git a/lib/Util.php b/lib/Util.php index f4318287..bea8d079 100644 --- a/lib/Util.php +++ b/lib/Util.php @@ -364,17 +364,14 @@ class Util * * @param string $key System config key * @param null|mixed $default Default value - * @param bool $force Do not check if the key is valid */ - public static function getSystemConfig(string $key, $default = null, bool $force = false) + public static function getSystemConfig(string $key, $default = null) { $config = \OC::$server->get(\OCP\IConfig::class); $defaults = self::systemConfigDefaults(); - if (!$force) { - if (!\array_key_exists($key, $defaults)) { - throw new \InvalidArgumentException("Invalid system config key: {$key}"); - } + if (!\array_key_exists($key, $defaults)) { + throw new \InvalidArgumentException("Invalid system config key: {$key}"); } return $config->getSystemValue($key, $default ?? $defaults[$key]); @@ -431,7 +428,7 @@ class Util */ public static function getInstanceId(): string { - return self::getSystemConfig('instanceid', 'default', true); + return self::getSystemConfig('instanceid'); } /**