refactor: remove force option from getSysConfig
Signed-off-by: Varun Patil <radialapps@gmail.com>pull/807/head
parent
deef94f7cd
commit
0752081d15
|
@ -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'),
|
||||
);
|
||||
|
|
|
@ -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'),
|
||||
|
||||
|
|
|
@ -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',
|
||||
];
|
||||
|
|
11
lib/Util.php
11
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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue