[FIX] Do not parse non-existing cache data, use SQL

This commit is contained in:
Sebastian Grewe 2013-10-23 07:55:17 +02:00
parent acfa8f246e
commit 1c5b53452a

View File

@ -395,8 +395,8 @@ class Statistics {
switch ($type) { switch ($type) {
case 'shares': case 'shares':
if ($data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) { if ($data = $this->memcache->get(STATISTICS_ALL_USER_SHARES)) {
// Use global cache to build data // Use global cache to build data, if we have any data there
$max = 0; if (!empty($data['data']) && is_array($data['data'])) {
foreach($data['data'] as $key => $aUser) { foreach($data['data'] as $key => $aUser) {
$shares[$key] = $aUser['valid']; $shares[$key] = $aUser['valid'];
$username[$key] = $aUser['username']; $username[$key] = $aUser['username'];
@ -413,6 +413,7 @@ class Statistics {
} }
return $data_new; return $data_new;
} }
}
// No cached data, fallback to SQL and cache in local cache // No cached data, fallback to SQL and cache in local cache
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT