- force => 1);
- }
-} # }}}
-
-package IkiWiki::PageSpec;
-
-sub parsesize ($) { #{{{
- my $size=shift;
- no warnings;
- my $base=$size+0; # force to number
- use warnings;
- my $multiple=1;
- if ($size=~/kb?$/i) {
- $multiple=2**10;
- }
- elsif ($size=~/mb?$/i) {
- $multiple=2**20;
- }
- elsif ($size=~/gb?$/i) {
- $multiple=2**30;
- }
- elsif ($size=~/tb?$/i) {
- $multiple=2**40;
- }
- return $base * $multiple;
-} #}}}
-
-sub match_maxsize ($$;@) { #{{{
- shift;
- my $maxsize=eval{parsesize(shift)};
- if ($@) {
- return IkiWiki::FailReason->new("unable to parse maxsize (or number too large)");
- }
-
- my %params=@_;
- if (! exists $params{file}) {
- return IkiWiki::FailReason->new("no file specified");
- }
-
- if (-s $params{file} > $maxsize) {
- return IkiWiki::FailReason->new("file too large");