← Index
NYTProf Performance Profile   « line view »
For ./view
  Run on Fri Jul 31 18:42:36 2015
Reported on Fri Jul 31 18:48:14 2015

Filename/var/www/foswikidev/core/lib/Foswiki/Plugins/MailerContribPlugin.pm
StatementsExecuted 11 statements in 357µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11114µs26µsFoswiki::Plugins::MailerContribPlugin::::BEGIN@4Foswiki::Plugins::MailerContribPlugin::BEGIN@4
11110µs33µsFoswiki::Plugins::MailerContribPlugin::::initPluginFoswiki::Plugins::MailerContribPlugin::initPlugin
1119µs13µsFoswiki::Plugins::MailerContribPlugin::::BEGIN@5Foswiki::Plugins::MailerContribPlugin::BEGIN@5
0000s0sFoswiki::Plugins::MailerContribPlugin::::_restNotifyFoswiki::Plugins::MailerContribPlugin::_restNotify
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# See bottom of file for license and copyright information
2package Foswiki::Plugins::MailerContribPlugin;
3
4228µs239µs
# spent 26µs (14+13) within Foswiki::Plugins::MailerContribPlugin::BEGIN@4 which was called: # once (14µs+13µs) by Foswiki::Plugin::BEGIN@2.24 at line 4
use strict;
# spent 26µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@4 # spent 13µs making 1 call to strict::import
52318µs218µs
# spent 13µs (9+4) within Foswiki::Plugins::MailerContribPlugin::BEGIN@5 which was called: # once (9µs+4µs) by Foswiki::Plugin::BEGIN@2.24 at line 5
use warnings;
# spent 13µs making 1 call to Foswiki::Plugins::MailerContribPlugin::BEGIN@5 # spent 4µs making 1 call to warnings::import
6
71600nsour $VERSION = '2.82';
81200nsour $RELEASE = '2.82';
91200nsour $SHORTDESCRIPTION = 'Supports e-mail notification of changes';
101200nsour $NO_PREFS_IN_TOPIC = 1;
11
12# Plugin init method, used to initialise handlers
13
# spent 33µs (10+23) within Foswiki::Plugins::MailerContribPlugin::initPlugin which was called: # once (10µs+23µs) by Foswiki::Plugin::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Plugin.pm:257] at line 250 of /var/www/foswikidev/core/lib/Foswiki/Plugin.pm
sub initPlugin {
1413µs123µs Foswiki::Func::registerRESTHandler(
# spent 23µs making 1 call to Foswiki::Func::registerRESTHandler
15 'notify', \&_restNotify,
16 authenticate => 1,
17 validate => 1,
18 http_allow => 'POST',
19 description =>
20 'Allow administrators to run the mailNotify process from the web.',
21 );
2214µs return 1;
23}
24
25# Run mailnotify using a rest handler
26sub _restNotify {
27 my ( $session, $plugin, $verb, $response ) = @_;
28
29 if ( !Foswiki::Func::isAnAdmin() ) {
30 $response->header( -status => 403, -type => 'text/plain' );
31 $response->print("Only administrators can do that");
32 }
33 else {
34
35 # Don't use the $response; we want to see things happening
36 local $| = 1; # autoflush on
37 require CGI;
38 print CGI::header( -status => 200, -type => 'text/plain' );
39
40 my $query = Foswiki::Func::getCgiQuery();
41 my %options = (
42 verbose => 1,
43 news => 1,
44 changes => 1,
45 reset => 1,
46 mail => 1
47 );
48
49 if ( $query->param('q') ) {
50 $options{verbose} = 0;
51 }
52 if ( $query->param('nonews') ) {
53 $options{news} = 0;
54 }
55 if ( $query->param('nochanges') ) {
56 $options{changes} = 0;
57 }
58 if ( $query->param('noreset') ) {
59 $options{reset} = 0;
60 }
61 if ( $query->param('nomail') ) {
62 $options{mail} = 0;
63 }
64
65 my @exwebs = split( ',', $query->param('excludewebs') || '' );
66 my @webs = split( ',', $query->param('webs') || '' );
67
68 require Foswiki::Contrib::MailerContrib;
69 Foswiki::Contrib::MailerContrib::mailNotify( \@webs, \@exwebs,
70 %options );
71 }
72 return undef;
73}
74
7513µs1;
76__END__