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

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