Explorar o código

fix(l2): ensureSchema() in getConfig/saveConfig so l2_topology_config always exists before read/write (config persists to DB reliably)

COBCO IT hai 3 días
pai
achega
45f617a523
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      web-modules/WecomCenter/lib/L2Store.php

+ 2 - 0
web-modules/WecomCenter/lib/L2Store.php

@@ -89,6 +89,7 @@ class L2Store {
 	}
 
 	public static function getConfig(): array {
+		self::ensureSchema();
 		$cfg = self::defaults();
 		try {
 			$rows = DB::select('SELECT config FROM '.self::CONFIG_TABLE.' WHERE id='.self::CONFIG_ID);
@@ -112,6 +113,7 @@ class L2Store {
 	}
 
 	public static function saveConfig(array $cfg): void {
+		self::ensureSchema();
 		$cfg = self::mergeDeep(self::defaults(), $cfg);
 		$json = json_encode($cfg, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
 		try {