diff --git a/system/pages/highscores.php b/system/pages/highscores.php index e3b64e3c07..e42e10dd42 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -135,6 +135,7 @@ $configHighscoresPerPage = setting('core.highscores_per_page'); $limit = $configHighscoresPerPage + 1; +$highscores = []; $needReCache = true; $cacheKey = 'highscores_' . $skill . '_' . $vocation . '_' . $page . '_' . $configHighscoresPerPage; @@ -158,7 +159,7 @@ ->selectRaw('accounts.country, players.id, players.name, players.account_id, players.level, players.vocation' . $outfit . $promotion) ->orderByDesc('value'); -if (!isset($highscores) || empty($highscores)) { +if (empty($highscores)) { if ($skill >= POT::SKILL_FIRST && $skill <= POT::SKILL_LAST) { // skills if ($db->hasColumn('players', 'skill_fist')) {// tfs 1.0 $skill_ids = array( @@ -201,16 +202,16 @@ $list = 'experience'; } } -} -$highscores = $query->get()->map(function($row) { - $tmp = $row->toArray(); - $tmp['online'] = $row->online_status; - $tmp['vocation'] = $row->vocation_name; - unset($tmp['online_table']); + $highscores = $query->get()->map(function($row) { + $tmp = $row->toArray(); + $tmp['online'] = $row->online_status; + $tmp['vocation'] = $row->vocation_name; + unset($tmp['online_table']); - return $tmp; -})->toArray(); + return $tmp; + })->toArray(); +} if ($cache->enabled() && $needReCache) { $cache->set($cacheKey, serialize($highscores), setting('core.highscores_cache_ttl') * 60);