Révision 17f78427
Whitespace cleanup
- remove trailing whitespace
- remove empty lines at the end of files
| plugins/newznab/nn_ | ||
|---|---|---|
| 101 | 101 |
}, |
| 102 | 102 |
data_source_attrs => {
|
| 103 | 103 |
min => '0', |
| 104 |
|
|
| 104 |
|
|
| 105 | 105 |
}, |
| 106 | 106 |
}, |
| 107 | 107 |
data_sources => [ |
| ... | ... | |
| 254 | 254 |
'config' => \&config, |
| 255 | 255 |
'show' => \&show, |
| 256 | 256 |
); |
| 257 |
|
|
| 257 |
|
|
| 258 | 258 |
die "Unknown command: $command" unless exists $commands{$command};
|
| 259 | 259 |
return $commands{$command}->($graph);
|
| 260 | 260 |
} |
| ... | ... | |
| 265 | 265 |
unless $graphs{$graph_name};
|
| 266 | 266 |
|
| 267 | 267 |
my $graph = $graphs{$graph_name};
|
| 268 |
run_queries($graph_name);
|
|
| 268 |
run_queries($graph_name); |
|
| 269 | 269 |
for my $ds (@{$graph->{data_sources}}) {
|
| 270 | 270 |
printf "%s.value %s\n", clean_fieldname($ds->{label}), ($data->{$ds->{name}} ? $data->{$ds->{name}} : '0');
|
| 271 | 271 |
} |
| ... | ... | |
| 298 | 298 |
} |
| 299 | 299 |
|
| 300 | 300 |
sub update_requests {
|
| 301 |
my ($dbh) = @_;
|
|
| 301 |
my ($dbh) = @_; |
|
| 302 | 302 |
my %queries = ( |
| 303 |
request => 'select count(*) as requests from userrequests where timestamp > now() - INTERVAL 5 MINUTE;',
|
|
| 304 |
download => 'select count(*) as downloads from userdownloads where timestamp > now() - INTERVAL 5 MINUTE;',
|
|
| 305 |
);
|
|
| 303 |
request => 'select count(*) as requests from userrequests where timestamp > now() - INTERVAL 5 MINUTE;', |
|
| 304 |
download => 'select count(*) as downloads from userdownloads where timestamp > now() - INTERVAL 5 MINUTE;', |
|
| 305 |
); |
|
| 306 | 306 |
for my $name ( qw(request download) ) {
|
| 307 |
my $query = $queries{$name};
|
|
| 308 |
my $sth = $dbh->prepare($query);
|
|
| 309 |
$sth->execute();
|
|
| 310 |
while (my $row = $sth->fetch) {
|
|
| 307 |
my $query = $queries{$name};
|
|
| 308 |
my $sth = $dbh->prepare($query); |
|
| 309 |
$sth->execute(); |
|
| 310 |
while (my $row = $sth->fetch) {
|
|
| 311 | 311 |
$data->{$name} = $row->[0];
|
| 312 | 312 |
} |
| 313 |
$sth->finish();
|
|
| 314 |
}
|
|
| 313 |
$sth->finish(); |
|
| 314 |
} |
|
| 315 | 315 |
} |
| 316 |
|
|
| 316 |
|
|
| 317 | 317 |
sub update_category {
|
| 318 | 318 |
my ($dbh) = @_; |
| 319 | 319 |
my $sth = $dbh->prepare('select count(*) as releases, category.title, category.id from releases LEFT JOIN category ON releases.categoryID = category.ID group by releases.categoryID');
|
| ... | ... | |
| 322 | 322 |
while (my $row = $sth->fetch) {
|
| 323 | 323 |
$data->{$row->[2]} = $row->[0];
|
| 324 | 324 |
} |
| 325 |
|
|
| 325 |
|
|
| 326 | 326 |
} |
| 327 | 327 |
sub update_releases {
|
| 328 | 328 |
my ($dbh) = @_; |
| ... | ... | |
| 331 | 331 |
$sth->execute(); |
| 332 | 332 |
}; |
| 333 | 333 |
if ($@) { die $@; }
|
| 334 |
my $row = $sth->fetchrow_hashref();
|
|
| 334 |
my $row = $sth->fetchrow_hashref(); |
|
| 335 | 335 |
$data->{releases} = $row->{'releases'};
|
| 336 | 336 |
$sth->finish(); |
| 337 | 337 |
} |
| ... | ... | |
| 343 | 343 |
$sth->execute(); |
| 344 | 344 |
}; |
| 345 | 345 |
if ($@) { die $@; }
|
| 346 |
my $row = $sth->fetchrow_hashref();
|
|
| 346 |
my $row = $sth->fetchrow_hashref(); |
|
| 347 | 347 |
$data->{users} = $row->{'users'};
|
| 348 | 348 |
$sth->finish(); |
| 349 | 349 |
} |
Formats disponibles : Unified diff