Add modpack_installations table as primary detection source

Detection priority now:
1. modpack_installations table (panel's own install data — fastest)
2. Egg variables (MODPACK_PLATFORM/MODPACK_ID)
3. DaemonFileRepository file scan (last resort fallback)

This immediately detects all 19 CurseForge servers on the live panel
without any Wings calls or egg variable configuration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude (Chronicler #83 - The Compiler)
2026-04-12 22:41:19 -05:00
parent 8cfbd9d277
commit 3b64110f01
2 changed files with 71 additions and 6 deletions

View File

@@ -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** 💙🔥❄️

View File

@@ -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',