Fix: graceful handling of missing modpack_installations table

- Cron and controller wrap modpack_installations queries in try/catch
- Falls through to egg variable / file detection if table missing
- Added migration with IF NOT EXISTS for fresh installs
- Migration won't drop the table (may be Pterodactyl-owned)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude (Chronicler #83 - The Compiler)
2026-04-13 00:44:28 -05:00
parent a256aa2090
commit 1783055c99
3 changed files with 53 additions and 13 deletions

View File

@@ -92,14 +92,18 @@ class ModpackAPIController extends Controller
};
}
// 2. Check modpack_installations table
// 2. Check modpack_installations table (Pterodactyl — may not exist)
if (empty($platform) || empty($modpackId)) {
$installation = DB::table('modpack_installations')
->where('server_id', $server->id)
->first();
if ($installation) {
$platform = $platform ?: ($installation->provider ?? null);
$modpackId = $modpackId ?: (string) ($installation->modpack_id ?? '');
try {
$installation = DB::table('modpack_installations')
->where('server_id', $server->id)
->first();
if ($installation) {
$platform = $platform ?: ($installation->provider ?? null);
$modpackId = $modpackId ?: (string) ($installation->modpack_id ?? '');
}
} catch (\Exception $e) {
// Table doesn't exist on this panel — skip
}
}