Skip to content
Browse files

Add max_posts calculation to Config.

  • Loading branch information...
1 parent b3d5f8f commit 1ed44a11ab3a842c3f7ef257f6c1128122c2a6f8 @gavincarr committed
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/Statik/Config.pm
View
9 lib/Statik/Config.pm
@@ -146,6 +146,8 @@ sub _map_booleans {
sub _clean_flavours {
my $self = shift;
+ my $max_posts = $self->{posts_per_page} * $self->{max_pages};
+
for my $key (keys %{$self->{_config}}) {
next unless $key =~ m/^flavour:(\w+)/;
my $flavour = $1;
@@ -159,8 +161,15 @@ sub _clean_flavours {
$fconfig->{$_} = 0, next if $fconfig->{$_} =~ m/^(no|off)/;
}
+ if ($fconfig->{posts_per_page} and $fconfig->{max_posts} and
+ $fconfig->{posts_per_page} * $fconfig->{max_posts} > $max_posts) {
+ $max_posts = $fconfig->{posts_per_page} * $fconfig->{max_posts};
+ }
+
$self->{_config}->{$key} = $fconfig;
}
+
+ $self->{max_posts} = $max_posts;
}
# Return non-private keys

0 comments on commit 1ed44a1

Please sign in to comment.
Something went wrong with that request. Please try again.