Filename | /var/www/foswiki11/lib/Foswiki/WebFilter.pm |
Statements | Executed 1006 statements in 4.17ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
100 | 1 | 1 | 4.03ms | 8.26s | ok | Foswiki::WebFilter::
5 | 4 | 2 | 233µs | 233µs | new | Foswiki::WebFilter::
1 | 1 | 1 | 12µs | 26µs | BEGIN@4 | Foswiki::WebFilter::
1 | 1 | 1 | 9µs | 14µs | BEGIN@5 | Foswiki::WebFilter::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki::WebFilter; | ||||
3 | |||||
4 | 2 | 27µs | 2 | 39µs | # spent 26µs (12+13) within Foswiki::WebFilter::BEGIN@4 which was called:
# once (12µs+13µs) by Foswiki::Search::BEGIN@23 at line 4 # spent 26µs making 1 call to Foswiki::WebFilter::BEGIN@4
# spent 13µs making 1 call to strict::import |
5 | 2 | 246µs | 2 | 19µs | # spent 14µs (9+5) within Foswiki::WebFilter::BEGIN@5 which was called:
# once (9µs+5µs) by Foswiki::Search::BEGIN@23 at line 5 # spent 14µs making 1 call to Foswiki::WebFilter::BEGIN@5
# spent 5µs making 1 call to warnings::import |
6 | |||||
7 | #TODO: documentme | ||||
8 | #TODO: should this be converted to a FilterIterator? | ||||
9 | |||||
10 | # spec in the $filter, | ||||
11 | # which may include one of: | ||||
12 | # 1 'user' (for only user webs) | ||||
13 | # 2 'template' (for only template webs) | ||||
14 | # $filter may also contain the word 'public' which will further filter | ||||
15 | # webs on whether NOSEARCHALL is specified for them or not. | ||||
16 | # 'allowed' filters out webs that the user is denied access to by a *WEBVIEW. | ||||
17 | |||||
18 | # spent 233µs within Foswiki::WebFilter::new which was called 5 times, avg 47µs/call:
# 2 times (160µs+0s) by Foswiki::Func::getListOfWebs at line 1476 of /var/www/foswiki11/lib/Foswiki/Func.pm, avg 80µs/call
# once (34µs+0s) by Foswiki::Search::BEGIN@23 at line 52
# once (20µs+0s) by Foswiki::Search::BEGIN@23 at line 54
# once (20µs+0s) by Foswiki::Search::BEGIN@23 at line 53 | ||||
19 | 5 | 10µs | my ( $class, $filter ) = @_; | ||
20 | 5 | 16µs | my $this = bless( {}, $class ); | ||
21 | 5 | 8µs | foreach my $f (qw(user template public allowed)) { | ||
22 | 20 | 183µs | $this->{$f} = ( $filter =~ /\b$f\b/ ); | ||
23 | } | ||||
24 | 5 | 27µs | return $this; | ||
25 | } | ||||
26 | |||||
27 | # spent 8.26s (4.03ms+8.25) within Foswiki::WebFilter::ok which was called 100 times, avg 82.6ms/call:
# 100 times (4.03ms+8.25s) by Foswiki::deepWebList at line 1575 of /var/www/foswiki11/lib/Foswiki.pm, avg 82.6ms/call | ||||
28 | 100 | 101µs | my ( $this, $session, $web ) = @_; | ||
29 | |||||
30 | 100 | 61µs | return 0 if $this->{template} && $web !~ /(?:^_|\/_)/; | ||
31 | |||||
32 | 100 | 85µs | return 1 if ( $web eq $session->{webName} ); | ||
33 | |||||
34 | 98 | 486µs | return 0 if $this->{user} && $web =~ /(?:^_|\/_)/; | ||
35 | |||||
36 | 95 | 273µs | 95 | 10.0ms | return 0 if !$session->webExists($web); # spent 10.0ms making 95 calls to Foswiki::webExists, avg 105µs/call |
37 | |||||
38 | 94 | 539µs | 94 | 2.71ms | my $webObject = Foswiki::Meta->new( $session, $web ); # spent 2.71ms making 94 calls to Foswiki::Meta::new, avg 29µs/call |
39 | 94 | 516µs | 188 | 7.94s | my $thisWebNoSearchAll = # spent 7.94s making 94 calls to Foswiki::Meta::getPreference, avg 84.5ms/call
# spent 1.46ms making 94 calls to Foswiki::isTrue, avg 16µs/call |
40 | Foswiki::isTrue( $webObject->getPreference('NOSEARCHALL') ); | ||||
41 | |||||
42 | 94 | 555µs | 94 | 520µs | return 0 # spent 520µs making 94 calls to Foswiki::Users::isAdmin, avg 6µs/call |
43 | if $this->{public} | ||||
44 | && !$session->{users}->isAdmin( $session->{user} ) | ||||
45 | && $thisWebNoSearchAll; | ||||
46 | |||||
47 | 93 | 334µs | 93 | 296ms | return 0 if $this->{allowed} && !$webObject->haveAccess('VIEW'); # spent 296ms making 93 calls to Foswiki::Meta::haveAccess, avg 3.18ms/call |
48 | |||||
49 | 90 | 689µs | return 1; | ||
50 | } | ||||
51 | |||||
52 | 1 | 3µs | 1 | 34µs | our $public = new Foswiki::WebFilter('public'); # spent 34µs making 1 call to Foswiki::WebFilter::new |
53 | 1 | 3µs | 1 | 20µs | our $user = new Foswiki::WebFilter('user'); # spent 20µs making 1 call to Foswiki::WebFilter::new |
54 | 1 | 2µs | 1 | 20µs | our $user_allowed = new Foswiki::WebFilter('user,allowed'); # spent 20µs making 1 call to Foswiki::WebFilter::new |
55 | |||||
56 | 1 | 4µs | 1; | ||
57 | __END__ |