Filename | /var/www/foswiki11/lib/Foswiki/Plugins/MailerContribPlugin.pm |
Statements | Executed 13 statements in 340µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 16µs | 22µs | BEGIN@5 | Foswiki::Plugins::MailerContribPlugin::
1 | 1 | 1 | 14µs | 27µs | BEGIN@4 | Foswiki::Plugins::MailerContribPlugin::
1 | 1 | 1 | 14µs | 42µs | initPlugin | Foswiki::Plugins::MailerContribPlugin::
1 | 1 | 1 | 13µs | 33µs | BEGIN@7 | 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 | 34µs | 2 | 41µs | # spent 27µs (14+14) within Foswiki::Plugins::MailerContribPlugin::BEGIN@4 which was called:
# once (14µs+14µs) by Foswiki::Plugin::BEGIN@2.21 at line 4 # spent 27µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@4
# spent 14µs making 1 call to strict::import |
5 | 2 | 27µs | 2 | 28µs | # spent 22µs (16+6) within Foswiki::Plugins::MailerContribPlugin::BEGIN@5 which was called:
# once (16µs+6µs) by Foswiki::Plugin::BEGIN@2.21 at line 5 # spent 22µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@5
# spent 6µs making 1 call to warnings::import |
6 | |||||
7 | 3 | 265µs | 3 | 59µs | # spent 33µs (13+20) within Foswiki::Plugins::MailerContribPlugin::BEGIN@7 which was called:
# once (13µs+20µs) by Foswiki::Plugin::BEGIN@2.21 at line 7 # spent 33µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@7
# spent 20µs making 1 call to version::import
# spent 6µs making 1 call to version::vxs::declare |
8 | 1 | 300ns | our $RELEASE = '2.5.3'; | ||
9 | 1 | 200ns | our $SHORTDESCRIPTION = 'Supports e-mail notification of changes'; | ||
10 | 1 | 100ns | our $NO_PREFS_IN_TOPIC = 1; | ||
11 | |||||
12 | # Plugin init method, used to initialise handlers | ||||
13 | # spent 42µs (14+28) within Foswiki::Plugins::MailerContribPlugin::initPlugin which was called:
# once (14µs+28µs) by Foswiki::Plugin::__ANON__[/var/www/foswiki11/lib/Foswiki/Plugin.pm:241] at line 234 of /var/www/foswiki11/lib/Foswiki/Plugin.pm | ||||
14 | 1 | 2µs | 1 | 28µs | Foswiki::Func::registerRESTHandler( 'notify', \&_restNotify ); # spent 28µs making 1 call to Foswiki::Func::registerRESTHandler |
15 | 1 | 6µ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 | 4µs | 1; | ||
45 | __END__ |