Fix #318 (online.php throws error in one scenario)

This commit is contained in:
slawkens
2025-08-07 21:17:25 +02:00
parent 9cb7792623
commit b6e1620f14
2 changed files with 12 additions and 3 deletions

View File

@@ -105,8 +105,17 @@ $cached = Cache::remember("online_$order", setting('core.online_cache_ttl') * 60
$result = null;
$timestamp = false;
if($db->hasTable('server_record')) {
$timestamp = true;
$result = ServerRecord::where('world_id', configLua('worldId'))->orderByDesc('record')->first()->toArray();
$timestamp = $db->hasColumn('server_record', 'timestamp');
$serverRecordQuery = ServerRecord::query();
if ($db->hasColumn('server_record', 'world_id')) {
$serverRecordQuery->where('world_id', configLua('worldId'));
}
$result = $serverRecordQuery->orderByDesc('record')->first();
if ($result) {
$result = $result->toArray();
}
} else if($db->hasTable('server_config')) { // tfs 1.0
$row = ServerConfig::where('config', 'players_record')->first();
if ($row) {

View File

@@ -90,7 +90,7 @@
</td>
</tr>
{% if setting('core.online_record') %}
{% if setting('core.online_record') and record|length > 0 %}
<tr>
<td class="LabelV150"><b>Online Record:</b></td>
<td>