Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 32 lines 1.6 kB view raw
1diff --git a/lib/Settings/SystemConfig.php b/lib/Settings/SystemConfig.php 2index 7814f071..bb1309fa 100644 3--- a/lib/Settings/SystemConfig.php 4+++ b/lib/Settings/SystemConfig.php 5@@ -124,6 +125,14 @@ class SystemConfig 6 */ 7 public static function get(string $key, mixed $default = null): mixed 8 { 9+ switch ($key) { 10+ case "memories.exiftool": return "@exiftool@"; 11+ case "memories.exiftool_no_local": return false; 12+ case "memories.vod.ffmpeg": return "@ffmpeg@"; 13+ case "memories.vod.ffprobe": return "@ffprobe@"; 14+ case "memories.vod.path": return "@go-vod@"; 15+ } 16+ 17 if (!\array_key_exists($key, self::DEFAULTS)) { 18 throw new \InvalidArgumentException("Invalid system config key: {$key}"); 19 } 20@@ -154,6 +161,12 @@ public static function get(string $key, mixed $default = null): mixed 21 */ 22 public static function set(string $key, mixed $value): void 23 { 24+ // Ignore those paths and always use the nix paths. 25+ // We cannot return a proper error message except a 500 here without changing the code to much. 26+ if (in_array($key, array("memories.exiftool", "memories.exiftool_no_local", "memories.vod.ffmpeg", "memories.vod.ffprobe", "memories.vod.path"))) { 27+ throw new \InvalidArgumentException("Cannot set nix-managed key: {$key}"); 28+ } 29+ 30 // Check if the key is valid 31 if (!\array_key_exists($key, self::DEFAULTS)) { 32 throw new \InvalidArgumentException("Invalid system config key: {$key}");