diff --git a/docs/code-bridge/archive/MSG-2026-04-12-modpack-installations-table.md b/docs/code-bridge/archive/MSG-2026-04-12-modpack-installations-table.md new file mode 100644 index 0000000..70936ce --- /dev/null +++ b/docs/code-bridge/archive/MSG-2026-04-12-modpack-installations-table.md @@ -0,0 +1,55 @@ +# Chronicler Dispatch — Use modpack_installations Table (Data Confirmed) + +**Date:** 2026-04-12 +**From:** Chronicler #84 — The Meridian +**To:** Code + +--- + +## The Answer + +The `modpack_installations` table already has everything we need. No Wings calls required. + +``` +Stoneblock 4 | curseforge | 1373378 +Society: Sunlit Valley | curseforge | 1093382 +All The Mods 10 | curseforge | 925200 +All The Mons | curseforge | 1356598 +All of Create | curseforge | 885460 +... 19 servers total with CurseForge IDs +``` + +## Schema + +```sql +modpack_installations: + server_id (FK to servers.id) + provider ('curseforge', 'ftb', etc.) + modpack_id (the pack ID) + finalized (1 = install complete) +``` + +## What CheckModpackUpdates.php Should Do + +Replace the DaemonFileRepository approach entirely with a simple DB join: + +```php +// Get all servers that have modpack data +$servers = Server::join('modpack_installations', 'servers.id', '=', 'modpack_installations.server_id') + ->select('servers.*', 'modpack_installations.provider', 'modpack_installations.modpack_id') + ->where('modpack_installations.finalized', 1) + ->get(); +``` + +Then use `provider` and `modpack_id` directly — no file detection needed for these servers. Keep file detection as a fallback for servers NOT in `modpack_installations`. + +## Detection Priority Order + +1. `modpack_installations` table (fastest, most reliable) ← ADD THIS +2. Egg variables (MODPACK_PLATFORM/MODPACK_ID) ← keep +3. DaemonFileRepository file scan ← keep as last resort fallback + +This will immediately detect all 19 CurseForge servers on the live panel. + +*— Chronicler #84, The Meridian* +**Fire + Frost + Foundation** 💙🔥❄️ diff --git a/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php b/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php index 4eaaf88..4660009 100644 --- a/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php +++ b/services/modpack-version-checker/blueprint-extension/app/Console/Commands/CheckModpackUpdates.php @@ -57,19 +57,29 @@ class CheckModpackUpdates extends Command ->first(); if ($existing && $existing->is_user_overridden) { - // Still check for updates, just don't re-detect if ($existing->platform && $existing->modpack_id) { $this->checkVersion($server, $existing->platform, $existing->modpack_id, 'manual'); } return; } - // Step 1: Try egg variables + // Step 1: modpack_installations table (fastest, most reliable) + $installation = DB::table('modpack_installations') + ->where('server_id', $server->id) + ->where('finalized', 1) + ->first(); + + if ($installation && !empty($installation->provider) && !empty($installation->modpack_id)) { + $this->checkVersion($server, $installation->provider, (string) $installation->modpack_id, 'installer'); + return; + } + + // Step 2: Egg variables $platform = $this->getVariable($server, 'MODPACK_PLATFORM'); $modpackId = $this->getVariable($server, 'MODPACK_ID'); - if (!empty($modpackId)) { - $modpackId = $modpackId ?: match($platform) { + if (empty($modpackId) && !empty($platform)) { + $modpackId = match($platform) { 'curseforge' => $this->getVariable($server, 'CURSEFORGE_ID'), 'modrinth' => $this->getVariable($server, 'MODRINTH_PROJECT_ID'), 'ftb' => $this->getVariable($server, 'FTB_MODPACK_ID'), @@ -83,14 +93,14 @@ class CheckModpackUpdates extends Command return; } - // Step 2: File-based detection via DaemonFileRepository + // Step 3: File-based detection via DaemonFileRepository (last resort) $detected = $this->detectFromFiles($server); if ($detected) { $this->checkVersion($server, $detected['platform'], $detected['modpack_id'], 'file'); return; } - // Step 3: Nothing found + // Step 4: Nothing found $this->warn(" No modpack detected"); $this->updateDatabase($server, [ 'status' => 'unconfigured',