Filename | /usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugins/MailerContribPlugin.pm |
Statements | Executed 11 statements in 522µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 26µs | 97µs | initPlugin | Foswiki::Plugins::MailerContribPlugin::
1 | 1 | 1 | 26µs | 33µs | BEGIN@4 | Foswiki::Plugins::MailerContribPlugin::
1 | 1 | 1 | 17µs | 36µs | BEGIN@5 | Foswiki::Plugins::MailerContribPlugin::
0 | 0 | 0 | 0s | 0s | _restNotify | Foswiki::Plugins::MailerContribPlugin::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # See bottom of file for license and copyright information | ||||
2 | package Foswiki::Plugins::MailerContribPlugin; | ||||
3 | |||||
4 | 2 | 46µs | 2 | 41µs | # spent 33µs (26+8) within Foswiki::Plugins::MailerContribPlugin::BEGIN@4 which was called:
# once (26µs+8µs) by Foswiki::Plugin::BEGIN@2.11 at line 4 # spent 33µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@4
# spent 8µs making 1 call to strict::import |
5 | 2 | 441µs | 2 | 55µs | # spent 36µs (17+19) within Foswiki::Plugins::MailerContribPlugin::BEGIN@5 which was called:
# once (17µs+19µs) by Foswiki::Plugin::BEGIN@2.11 at line 5 # spent 36µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@5
# spent 19µs making 1 call to warnings::import |
6 | |||||
7 | 1 | 2µs | our $VERSION = '$Rev: 5752 $'; | ||
8 | 1 | 2µs | our $RELEASE = '9 Jul 2010'; | ||
9 | 1 | 1µs | our $SHORTDESCRIPTION = 'Supports e-mail notification of changes'; | ||
10 | 1 | 1µs | our $NO_PREFS_IN_TOPIC = 1; | ||
11 | |||||
12 | # Plugin init method, used to initialise handlers | ||||
13 | # spent 97µs (26+71) within Foswiki::Plugins::MailerContribPlugin::initPlugin which was called:
# once (26µs+71µs) by Foswiki::Plugin::__ANON__[/usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugin.pm:235] at line 228 of /usr/local/src/github.com/foswiki/core/lib/Foswiki/Plugin.pm | ||||
14 | 1 | 7µs | 1 | 71µs | Foswiki::Func::registerRESTHandler( 'notify', \&_restNotify ); # spent 71µs making 1 call to Foswiki::Func::registerRESTHandler |
15 | 1 | 14µs | return 1; | ||
16 | } | ||||
17 | |||||
18 | # Run mailnotify using a rest handler | ||||
19 | sub _restNotify { | ||||
20 | my ( $session, $plugin, $verb, $response ) = @_; | ||||
21 | |||||
22 | if ( !Foswiki::Func::isAnAdmin() ) { | ||||
23 | $response->header( -status => 403, -type => 'text/plain' ); | ||||
24 | $response->print("Only administrators can do that"); | ||||
25 | } | ||||
26 | else { | ||||
27 | |||||
28 | # Don't use the $response; we want to see things happening | ||||
29 | local $| = 1; # autoflush on | ||||
30 | require CGI; | ||||
31 | print CGI::header( -status => 200, -type => 'text/plain' ); | ||||
32 | my $query = Foswiki::Func::getCgiQuery(); | ||||
33 | my $nonews = $query->param('nonews'); | ||||
34 | my $nochanges = $query->param('nochanges'); | ||||
35 | my @exwebs = split( ',', $query->param('excludewebs') || '' ); | ||||
36 | my @webs = split( ',', $query->param('webs') || '' ); | ||||
37 | require Foswiki::Contrib::MailerContrib; | ||||
38 | Foswiki::Contrib::MailerContrib::mailNotify( \@webs, 1, \@exwebs, | ||||
39 | $nonews, $nochanges ); | ||||
40 | } | ||||
41 | return undef; | ||||
42 | } | ||||
43 | |||||
44 | 1 | 6µs | 1; | ||
45 | __END__ |