blob: 25044e8c7196e6ba2d062aeedc09c7d649d265f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package MasterServer::Core::Stats;
use strict;
use warnings;
use AnyEvent::IO;
use Exporter 'import';
our @EXPORT = qw| update_stats |;
################################################################################
# Update statistics on servers and update the games table with those values
################################################################################
sub update_stats {
my $self = shift;
# get all gamenames where there is one or more servers online and update the
# stats per gamename.
my $games = $self->get_gamelist_stats();
# iterate through available stats
for my $e (@{$games}) {
# extract gamename, number of direct uplinks and total servers
my %opt = ();
$opt{gamename} = $e->[0];
$opt{num_uplink} = $e->[1];
$opt{num_total} = $e->[2];
# write to DB
$self->write_stat(%opt);
}
#done
$self->log("stat", "Updated all game statistics.");
}
1;
|