← 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/Plugin.pm
StatementsExecuted 11923 statements in 19.6ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1632119.64ms37.7msFoswiki::Plugin::::invokeFoswiki::Plugin::invoke (recurses: max depth 1, inclusive time 136µs)
42115.31ms65.6msFoswiki::Plugin::::registerHandlersFoswiki::Plugin::registerHandlers
42112.27ms117msFoswiki::Plugin::::newFoswiki::Plugin::new
42111.84ms2.87msFoswiki::Plugin::::loadFoswiki::Plugin::load
111822µs900µsFoswiki::Plugin::::BEGIN@15Foswiki::Plugin::BEGIN@15
4211443µs59.0msFoswiki::Plugin::::__ANON__[:257]Foswiki::Plugin::__ANON__[:257]
111357µs402µsFoswiki::Plugin::::BEGIN@14Foswiki::Plugin::BEGIN@14
4211354µs354µsFoswiki::Plugin::::finishFoswiki::Plugin::finish
111247µs293µsFoswiki::Plugin::::BEGIN@16Foswiki::Plugin::BEGIN@16
5631219µs801µsFoswiki::Plugin::::topicWebFoswiki::Plugin::topicWeb
4211106µs11.9msFoswiki::Plugin::::registerSettingsFoswiki::Plugin::registerSettings
11112µs25µsFoswiki::Plugin::::BEGIN@8Foswiki::Plugin::BEGIN@8
11112µs110µsFoswiki::Plugin::::BEGIN@11Foswiki::Plugin::BEGIN@11
11111µs34µsFoswiki::Plugin::::BEGIN@10Foswiki::Plugin::BEGIN@10
11110µs19µsFoswiki::Plugin::::BEGIN@217Foswiki::Plugin::BEGIN@217
11110µs21µsFoswiki::Plugin::::BEGIN@249Foswiki::Plugin::BEGIN@249
11110µs19µsFoswiki::Plugin::::BEGIN@256Foswiki::Plugin::BEGIN@256
1119µs22µsFoswiki::Plugin::::BEGIN@122Foswiki::Plugin::BEGIN@122
1118µs20µsFoswiki::Plugin::::BEGIN@197Foswiki::Plugin::BEGIN@197
1118µs18µsFoswiki::Plugin::::BEGIN@211Foswiki::Plugin::BEGIN@211
1118µs12µsFoswiki::Plugin::::BEGIN@9Foswiki::Plugin::BEGIN@9
1118µs18µsFoswiki::Plugin::::BEGIN@309Foswiki::Plugin::BEGIN@309
1118µs17µsFoswiki::Plugin::::BEGIN@124Foswiki::Plugin::BEGIN@124
1117µs16µsFoswiki::Plugin::::BEGIN@199Foswiki::Plugin::BEGIN@199
1117µs16µsFoswiki::Plugin::::BEGIN@329Foswiki::Plugin::BEGIN@329
1117µs16µsFoswiki::Plugin::::BEGIN@319Foswiki::Plugin::BEGIN@319
1117µs15µsFoswiki::Plugin::::BEGIN@331Foswiki::Plugin::BEGIN@331
1117µs15µsFoswiki::Plugin::::BEGIN@311Foswiki::Plugin::BEGIN@311
1117µs15µsFoswiki::Plugin::::BEGIN@321Foswiki::Plugin::BEGIN@321
1114µs4µsFoswiki::Plugin::::BEGIN@13Foswiki::Plugin::BEGIN@13
1114µs4µsFoswiki::Plugin::::BEGIN@18Foswiki::Plugin::BEGIN@18
0000s0sFoswiki::Plugin::::__ANON__[:260]Foswiki::Plugin::__ANON__[:260]
0000s0sFoswiki::Plugin::::__ANON__[:263]Foswiki::Plugin::__ANON__[:263]
0000s0sFoswiki::Plugin::::__ANON__[:266]Foswiki::Plugin::__ANON__[:266]
0000s0sFoswiki::Plugin::::__ANON__[:270]Foswiki::Plugin::__ANON__[:270]
0000s0sFoswiki::Plugin::::getDescriptionFoswiki::Plugin::getDescription
0000s0sFoswiki::Plugin::::getReleaseFoswiki::Plugin::getRelease
0000s0sFoswiki::Plugin::::getVersionFoswiki::Plugin::getVersion
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
2
3# PRIVATE CLASS Foswiki::Plugin
4#
5# Reference information for a single plugin.
6package Foswiki::Plugin;
7
8225µs237µs
# spent 25µs (12+12) within Foswiki::Plugin::BEGIN@8 which was called: # once (12µs+12µs) by Foswiki::Plugins::BEGIN@21 at line 8
use strict;
# spent 25µs making 1 call to Foswiki::Plugin::BEGIN@8 # spent 12µs making 1 call to strict::import
9224µs216µs
# spent 12µs (8+4) within Foswiki::Plugin::BEGIN@9 which was called: # once (8µs+4µs) by Foswiki::Plugins::BEGIN@21 at line 9
use warnings;
# spent 12µs making 1 call to Foswiki::Plugin::BEGIN@9 # spent 4µs making 1 call to warnings::import
10227µs258µs
# spent 34µs (11+23) within Foswiki::Plugin::BEGIN@10 which was called: # once (11µs+23µs) by Foswiki::Plugins::BEGIN@21 at line 10
use Assert;
# spent 34µs making 1 call to Foswiki::Plugin::BEGIN@10 # spent 23µs making 1 call to Exporter::import
11229µs2209µs
# spent 110µs (12+98) within Foswiki::Plugin::BEGIN@11 which was called: # once (12µs+98µs) by Foswiki::Plugins::BEGIN@21 at line 11
use Error qw(:try);
# spent 110µs making 1 call to Foswiki::Plugin::BEGIN@11 # spent 98µs making 1 call to Error::import
12
13219µs14µs
# spent 4µs within Foswiki::Plugin::BEGIN@13 which was called: # once (4µs+0s) by Foswiki::Plugins::BEGIN@21 at line 13
use Foswiki::Plugins ();
# spent 4µs making 1 call to Foswiki::Plugin::BEGIN@13
142130µs1402µs
# spent 402µs (357+46) within Foswiki::Plugin::BEGIN@14 which was called: # once (357µs+46µs) by Foswiki::Plugins::BEGIN@21 at line 14
use Foswiki::AccessControlException ();
# spent 402µs making 1 call to Foswiki::Plugin::BEGIN@14
152123µs1900µs
# spent 900µs (822+78) within Foswiki::Plugin::BEGIN@15 which was called: # once (822µs+78µs) by Foswiki::Plugins::BEGIN@21 at line 15
use Foswiki::OopsException ();
# spent 900µs making 1 call to Foswiki::Plugin::BEGIN@15
162111µs1293µs
# spent 293µs (247+46) within Foswiki::Plugin::BEGIN@16 which was called: # once (247µs+46µs) by Foswiki::Plugins::BEGIN@21 at line 16
use Foswiki::ValidationException ();
# spent 293µs making 1 call to Foswiki::Plugin::BEGIN@16
17
18
# spent 4µs within Foswiki::Plugin::BEGIN@18 which was called: # once (4µs+0s) by Foswiki::Plugins::BEGIN@21 at line 23
BEGIN {
1915µs if ( $Foswiki::cfg{UseLocale} ) {
20 require locale;
21 import locale();
22 }
231249µs14µs}
# spent 4µs making 1 call to Foswiki::Plugin::BEGIN@18
24
2515µsour @registrableHandlers = ( # Foswiki::Plugins::VERSION:
26 'afterAttachmentSaveHandler', # 1.022 DEPRECATED
27 'afterUploadHandler', # 2.1
28 'afterCommonTagsHandler', # 1.024
29 'afterEditHandler', # 1.010
30 'afterRenameHandler', # 1.110
31 'afterSaveHandler', # 1.020
32 'beforeAttachmentSaveHandler', # 1.022 DEPRECATED
33 'beforeCommonTagsHandler', # 1.024
34 'beforeEditHandler', # 1.010
35 'beforeMergeHandler', # 1.200
36 'beforeSaveHandler', # 1.010
37 'beforeUploadHandler', # 2.1
38 'commonTagsHandler', # 1.000
39 'completePageHandler', # 1.100
40 'earlyInitPlugin', # 1.020
41 'endRenderingHandler', # 1.000 DEPRECATED
42 'finishPlugin', # 2.100
43 'initPlugin', # 1.000
44 'initializeUserHandler', # 1.010
45 'insidePREHandler', # 1.000 DEPRECATED
46 'modifyHeaderHandler', # 1.026
47 'mergeHandler', # 1.026
48 'outsidePREHandler', # 1.000 DEPRECATED
49 'postRenderingHandler', # 1.026
50 'preRenderingHandler', # 1.026
51 'redirectCgiQueryHandler', # 1.010 DEPRECATED
52 'registrationHandler', # 1.010
53 'renderFormFieldForEditHandler', # ?
54 'renderWikiWordHandler', # 1.023
55 'startRenderingHandler', # 1.000 DEPRECATED
56 'validateRegistrationHandler', # 2.3
57 'writeHeaderHandler', # 1.010 DEPRECATED
58);
59
60# deprecated handlers
6114µsour %deprecated = (
62 afterAttachmentSaveHandler => 1,
63 beforeAttachmentSaveHandler => 1,
64 endRenderingHandler => 1,
65 insidePREHandler => 1,
66 outsidePREHandler => 1,
67 redirectCgiQueryHandler => 1,
68 startRenderingHandler => 1,
69 writeHeaderHandler => 1,
70);
71
72=begin TML
73
74---++ ClassMethod new( $session, $name, [, $module] )
75
76 * =$session= - Foswiki object
77 * =$name= - name of the plugin e.g. MyPlugin
78 * =$module= - name of implementing package; optional, used for tests.
79 Normally =load= is used to discover the module from the config.
80
81=cut
82
83
# spent 117ms (2.27+115) within Foswiki::Plugin::new which was called 42 times, avg 2.80ms/call: # 42 times (2.27ms+115ms) by Foswiki::Plugins::preload at line 195 of /var/www/foswikidev/core/lib/Foswiki/Plugins.pm, avg 2.80ms/call
sub new {
844242µs my ( $class, $session, $name, $module ) = @_;
85 ASSERT( UNTAINTED($name), "Name $name is tainted!" ) if DEBUG;
8642202µs my $this = bless(
87 {
88 session => $session,
89 name => $name || '',
90 module => $module, # if undef, use discovery
91 errors => []
92 },
93 $class
94 );
95
964254µs my $p = $Foswiki::cfg{Plugins}{$name}{Module};
97
984210µs unless ($p) {
99206µs $p = "Foswiki::Plugins::$name";
100 push(
101204µs @{ $this->{errors} },
102"$p has been guessed. '\$Foswiki::cfg{Plugins}{$name}{Module}' should be defined in LocalSite.cfg"
103 ) if DEBUG;
104 }
105
106421.41ms eval "use $p";
# spent 223µs executing statements in 2 string evals (merged)
# includes 1.75ms spent executing 2 calls to 2 subs defined therein. # spent 200µs executing statements in 2 string evals (merged)
# includes 2.40ms spent executing 2 calls to 2 subs defined therein. # spent 182µs executing statements in 2 string evals (merged)
# includes 1.56ms spent executing 2 calls to 2 subs defined therein. # spent 121µs executing statements in string eval
# includes 7.75ms spent executing 1 call to 1 sub defined therein. # spent 116µs executing statements in string eval
# includes 409µs spent executing 1 call to 1 sub defined therein. # spent 116µs executing statements in string eval
# includes 2.65ms spent executing 1 call to 1 sub defined therein. # spent 114µs executing statements in string eval
# includes 759µs spent executing 1 call to 1 sub defined therein. # spent 113µs executing statements in 2 string evals (merged)
# includes 1.07ms spent executing 2 calls to 2 subs defined therein. # spent 109µs executing statements in string eval
# includes 726µs spent executing 1 call to 1 sub defined therein. # spent 106µs executing statements in string eval
# includes 1.65ms spent executing 1 call to 1 sub defined therein. # spent 102µs executing statements in string eval
# includes 627µs spent executing 1 call to 1 sub defined therein. # spent 101µs executing statements in string eval
# includes 1.93ms spent executing 1 call to 1 sub defined therein. # spent 100µs executing statements in string eval
# includes 2.54ms spent executing 1 call to 1 sub defined therein. # spent 100µs executing statements in string eval
# includes 486µs spent executing 1 call to 1 sub defined therein. # spent 99µs executing statements in string eval
# includes 1.41ms spent executing 1 call to 1 sub defined therein. # spent 98µs executing statements in string eval
# includes 559µs spent executing 1 call to 1 sub defined therein. # spent 98µs executing statements in string eval
# includes 910µs spent executing 1 call to 1 sub defined therein. # spent 97µs executing statements in string eval
# includes 1.40ms spent executing 1 call to 1 sub defined therein. # spent 96µs executing statements in string eval
# includes 512µs spent executing 1 call to 1 sub defined therein. # spent 94µs executing statements in string eval
# includes 381µs spent executing 1 call to 1 sub defined therein. # spent 94µs executing statements in string eval
# includes 1.21ms spent executing 1 call to 1 sub defined therein. # spent 93µs executing statements in string eval
# includes 2.02ms spent executing 1 call to 1 sub defined therein. # spent 93µs executing statements in string eval
# includes 1.76ms spent executing 1 call to 1 sub defined therein. # spent 92µs executing statements in string eval
# includes 5.52ms spent executing 1 call to 1 sub defined therein. # spent 92µs executing statements in string eval
# includes 774µs spent executing 1 call to 1 sub defined therein. # spent 92µs executing statements in string eval
# includes 1.18ms spent executing 1 call to 1 sub defined therein. # spent 91µs executing statements in string eval
# includes 1.53ms spent executing 1 call to 1 sub defined therein. # spent 91µs executing statements in string eval
# includes 1.15ms spent executing 1 call to 1 sub defined therein. # spent 90µs executing statements in string eval
# includes 366µs spent executing 1 call to 1 sub defined therein. # spent 90µs executing statements in string eval
# includes 1.08ms spent executing 1 call to 1 sub defined therein. # spent 90µs executing statements in string eval
# includes 1.39ms spent executing 1 call to 1 sub defined therein. # spent 89µs executing statements in string eval
# includes 2.73ms spent executing 1 call to 1 sub defined therein. # spent 88µs executing statements in string eval
# includes 859µs spent executing 1 call to 1 sub defined therein. # spent 86µs executing statements in string eval
# includes 261µs spent executing 1 call to 1 sub defined therein. # spent 84µs executing statements in string eval
# includes 194µs spent executing 1 call to 1 sub defined therein. # spent 83µs executing statements in string eval
# includes 235µs spent executing 1 call to 1 sub defined therein. # spent 82µs executing statements in string eval
# includes 387µs spent executing 1 call to 1 sub defined therein. # spent 81µs executing statements in string eval
# includes 409µs spent executing 1 call to 1 sub defined therein.
1074217µs if ($@) {
108 push(
109 @{ $this->{errors} },
110 "$p could not be loaded. Errors were:\n$@\n----"
111 );
112 $this->{disabled} = 1;
113 $this->{reason} = 'no_load_plugin';
114 }
115 else {
1164249µs $this->{module} = $p;
117 }
1184224µs my $fn = "${p}::preload";
11942125µs if ( !$this->{disabled} && defined &$fn ) {
120
121 # A preload handler can simply die if it doesn't like what it sees
122237µs235µs
# spent 22µs (9+13) within Foswiki::Plugin::BEGIN@122 which was called: # once (9µs+13µs) by Foswiki::Plugins::BEGIN@21 at line 122
no strict 'refs';
# spent 22µs making 1 call to Foswiki::Plugin::BEGIN@122 # spent 13µs making 1 call to strict::unimport
123 &$fn($session);
1242267µs226µs
# spent 17µs (8+9) within Foswiki::Plugin::BEGIN@124 which was called: # once (8µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 124
use strict 'refs';
# spent 17µs making 1 call to Foswiki::Plugin::BEGIN@124 # spent 9µs making 1 call to strict::import
125 }
126
12742148µs return $this;
128}
129
130=begin TML
131
132---++ ObjectMethod finish()
133Break circular references.
134
135=cut
136
137# Note to developers; please undef *all* fields in the object explicitly,
138# whether they are references or not. That way this method is "golden
139# documentation" of the live fields in the object.
140
# spent 354µs within Foswiki::Plugin::finish which was called 42 times, avg 8µs/call: # 42 times (354µs+0s) by Foswiki::Plugins::finish at line 113 of /var/www/foswikidev/core/lib/Foswiki/Plugins.pm, avg 8µs/call
sub finish {
141428µs my $this = shift;
142
1434280µs undef $this->{name};
1444222µs undef $this->{topicWeb};
1454256µs undef $this->{module};
1464247µs undef $this->{errors};
1474256µs undef $this->{disabled};
1484210µs undef $this->{reason};
149428µs undef $this->{no_topic};
1504227µs undef $this->{description};
1514273µs undef $this->{session};
152}
153
154# Load and verify a plugin, invoking any early registration
155# handlers. Return the user resulting from the user handler call.
156
# spent 2.87ms (1.84+1.03) within Foswiki::Plugin::load which was called 42 times, avg 68µs/call: # 42 times (1.84ms+1.03ms) by Foswiki::Plugins::load at line 230 of /var/www/foswikidev/core/lib/Foswiki/Plugins.pm, avg 68µs/call
sub load {
1574216µs my ($this) = @_;
158
1594216µs return if $this->{disabled};
160
16142669µs my $noTopic = eval '$' . $this->{module} . '::NO_PREFS_IN_TOPIC';
# spent 6µs executing statements in string eval # spent 4µs executing statements in string eval # spent 3µs executing statements in 2 string evals (merged) # spent 3µs executing statements in 2 string evals (merged) # spent 3µs executing statements in 2 string evals (merged) # spent 3µs executing statements in 2 string evals (merged) # spent 3µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval
1624227µs $this->{no_topic} = $noTopic;
1634214µs $this->{topicWeb} = undef; # not known yet
164
165427µs unless ($noTopic) {
166713µs7699µs if ( !$this->topicWeb() ) {
# spent 699µs making 7 calls to Foswiki::Plugin::topicWeb, avg 100µs/call
167
168 # not found
169 push(
170 @{ $this->{errors} },
171 'Plugins: could not fully register '
172 . $this->{name}
173 . ', no plugin topic'
174 );
175 $noTopic = 1;
176 }
177 }
178
179 # Get the description from the code, if present. if it's not there, it'll
180 # be loaded as a preference from the plugin topic later
18142579µs $this->{description} = eval '$' . $this->{module} . '::SHORTDESCRIPTION';
# spent 4µs executing statements in 2 string evals (merged) # spent 3µs executing statements in 2 string evals (merged) # spent 3µs executing statements in 2 string evals (merged) # spent 3µs executing statements in 2 string evals (merged) # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval # spent 1µs executing statements in string eval
182
183 # Set the session for this call stack
1844218µs local $Foswiki::Plugins::SESSION = $this->{session};
185 ASSERT( $Foswiki::Plugins::SESSION->isa('Foswiki') ) if DEBUG;
186
1874218µs my $sub = $this->{module} . "::initPlugin";
1884261µs if ( !defined(&$sub) ) {
189 push( @{ $this->{errors} }, $sub . ' is not defined' );
190 $this->{disabled} = 1;
191 $this->{reason} = 'no_initPlugin';
192 return;
193 }
194
1954210µs $sub = $this->{module} . '::earlyInitPlugin';
1964289µs if ( defined(&$sub) ) {
197234µs230µs
# spent 20µs (8+11) within Foswiki::Plugin::BEGIN@197 which was called: # once (8µs+11µs) by Foswiki::Plugins::BEGIN@21 at line 197
no strict 'refs';
# spent 20µs making 1 call to Foswiki::Plugin::BEGIN@197 # spent 11µs making 1 call to strict::unimport
198 my $error = &$sub();
199266µs225µs
# spent 16µs (7+9) within Foswiki::Plugin::BEGIN@199 which was called: # once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 199
use strict 'refs';
# spent 16µs making 1 call to Foswiki::Plugin::BEGIN@199 # spent 9µs making 1 call to strict::import
200 if ($error) {
201 push( @{ $this->{errors} }, $sub . ' failed: ' . $error );
202 $this->{disabled} = 1;
203 $this->{reason} = 'no_earlyInitPlugin';
204 return;
205 }
206 }
207
208425µs my $user;
2094213µs $sub = $this->{module} . '::initializeUserHandler';
2104254µs if ( defined(&$sub) ) {
211247µs227µs
# spent 18µs (8+9) within Foswiki::Plugin::BEGIN@211 which was called: # once (8µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 211
no strict 'refs';
# spent 18µs making 1 call to Foswiki::Plugin::BEGIN@211 # spent 10µs making 1 call to strict::unimport
212217µs6332µs $user = &$sub(
# spent 300µs making 2 calls to Foswiki::Request::url, avg 150µs/call # spent 17µs making 1 call to Foswiki::Plugins::HomePagePlugin::initializeUserHandler # spent 12µs making 1 call to Foswiki::Plugins::ModifyLoginPlugin::initializeUserHandler # spent 3µs making 2 calls to Foswiki::Request::pathInfo, avg 1µs/call
213 $this->{session}->{remoteUser},
214 $this->{session}->{request}->url(),
215 $this->{session}->{request}->path_info()
216 );
2172167µs228µs
# spent 19µs (10+9) within Foswiki::Plugin::BEGIN@217 which was called: # once (10µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 217
use strict 'refs';
# spent 19µs making 1 call to Foswiki::Plugin::BEGIN@217 # spent 9µs making 1 call to strict::import
218 }
219
220#print STDERR "Compile $this->{module}: ".timestr(timediff(new Benchmark, $begin))."\n";
221
22242118µs return $user;
223}
224
225# register plugin settings
226
# spent 11.9ms (106µs+11.8) within Foswiki::Plugin::registerSettings which was called 42 times, avg 285µs/call: # 42 times (106µs+11.8ms) by Foswiki::Plugins::settings at line 273 of /var/www/foswikidev/core/lib/Foswiki/Plugins.pm, avg 285µs/call
sub registerSettings {
2274213µs my ( $this, $plugins ) = @_;
228
2294210µs return if $this->{disabled};
230
2314214µs my $prefs = $this->{session}->{prefs};
2324288µs1411.8ms if ( !$this->{no_topic} ) {
# spent 11.8ms making 7 calls to Foswiki::Prefs::setPluginPreferences, avg 1.69ms/call # spent 12µs making 7 calls to Foswiki::Plugin::topicWeb, avg 2µs/call
233 $prefs->setPluginPreferences( $this->topicWeb(), $this->{name} );
234 }
235}
236
237# invoke plugin initialisation and register handlers.
238
# spent 65.6ms (5.31+60.3) within Foswiki::Plugin::registerHandlers which was called 42 times, avg 1.56ms/call: # 42 times (5.31ms+60.3ms) by Foswiki::Plugins::enable at line 307 of /var/www/foswikidev/core/lib/Foswiki/Plugins.pm, avg 1.56ms/call
sub registerHandlers {
2394217µs my ( $this, $plugins ) = @_;
240
2414211µs return if $this->{disabled};
242
2434219µs my $p = $this->{module};
2444212µs my $sub = $p . "::initPlugin";
2454216µs my $users = $Foswiki::Plugins::SESSION->{users};
246426µs my $status = 0;
247426µs my $exception = '';
248
# spent 59.0ms (443µs+58.6) within Foswiki::Plugin::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Plugin.pm:257] which was called 42 times, avg 1.41ms/call: # 42 times (443µs+58.6ms) by Error::subs::try at line 419 of Error.pm, avg 1.41ms/call
try {
249258µs231µs
# spent 21µs (10+10) within Foswiki::Plugin::BEGIN@249 which was called: # once (10µs+10µs) by Foswiki::Plugins::BEGIN@21 at line 249
no strict 'refs';
# spent 21µs making 1 call to Foswiki::Plugin::BEGIN@249 # spent 10µs making 1 call to strict::unimport
25042374µs12658.6ms $status = &$sub(
# spent 15.0ms making 1 call to Foswiki::Plugins::SmiliesPlugin::initPlugin # spent 10.7ms making 1 call to Foswiki::Plugins::InterwikiPlugin::initPlugin # spent 6.69ms making 1 call to Foswiki::Plugins::JHotDrawPlugin::initPlugin # spent 6.02ms making 1 call to Foswiki::Plugins::UpdatesPlugin::initPlugin # spent 5.49ms making 1 call to Foswiki::Plugins::DirectedGraphPlugin::initPlugin # spent 3.70ms making 1 call to Foswiki::Plugins::ConfigurePlugin::initPlugin # spent 2.88ms making 1 call to Foswiki::Plugins::JQueryPlugin::initPlugin # spent 2.30ms making 1 call to Foswiki::Plugins::FindElsewherePlugin::initPlugin # spent 1.81ms making 1 call to Foswiki::Plugins::ActionTrackerPlugin::initPlugin # spent 794µs making 1 call to Foswiki::Plugins::AutoViewTemplatePlugin::initPlugin # spent 552µs making 1 call to Foswiki::Plugins::CommentPlugin::initPlugin # spent 223µs making 1 call to Foswiki::Plugins::JEditableContribPlugin::initPlugin # spent 176µs making 1 call to Foswiki::Plugins::RevCommentPlugin::initPlugin # spent 175µs making 1 call to Foswiki::Plugins::WysiwygPlugin::initPlugin # spent 159µs making 1 call to Foswiki::Plugins::RenderFormPlugin::initPlugin # spent 154µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::initPlugin # spent 146µs making 1 call to Foswiki::Plugins::TwistyPlugin::initPlugin # spent 131µs making 42 calls to Foswiki::Users::getLoginName, avg 3µs/call # spent 129µs making 1 call to Foswiki::Plugins::MultiTopicSavePlugin::initPlugin # spent 109µs making 1 call to Foswiki::Plugins::SubscribePlugin::initPlugin # spent 106µs making 1 call to Foswiki::Plugins::RevisionLinkPlugin::initPlugin # spent 102µs making 1 call to Foswiki::Plugins::ChartPlugin::initPlugin # spent 100µs making 1 call to Foswiki::Plugins::NatEditPlugin::initPlugin # spent 96µs making 1 call to Foswiki::Plugins::EditTablePlugin::initPlugin # spent 93µs making 1 call to Foswiki::Plugins::RenderPlugin::initPlugin # spent 91µs making 42 calls to Foswiki::Plugin::topicWeb, avg 2µs/call # spent 88µs making 1 call to Foswiki::Plugins::TimeCalcPlugin::initPlugin # spent 72µs making 1 call to Foswiki::Plugins::RenderListPlugin::initPlugin # spent 64µs making 1 call to Foswiki::Plugins::AttachContentPlugin::initPlugin # spent 61µs making 1 call to Foswiki::Plugins::DelayMacroPlugin::initPlugin # spent 60µs making 1 call to Foswiki::Plugins::ChecklistPlugin::initPlugin # spent 58µs making 1 call to Foswiki::Plugins::ExpandTopicContentPlugin::initPlugin # spent 50µs making 1 call to Foswiki::Plugins::TablePlugin::initPlugin # spent 42µs making 1 call to Foswiki::Plugins::ExtendedWebListPlugin::initPlugin # spent 40µs making 1 call to Foswiki::Plugins::HistoryPlugin::initPlugin # spent 33µs making 1 call to Foswiki::Plugins::MailerContribPlugin::initPlugin # spent 29µs making 1 call to Foswiki::Plugins::SetFormValuesPlugin::initPlugin # spent 26µs making 1 call to Foswiki::Plugins::HolidaylistPlugin::initPlugin # spent 21µs making 1 call to Foswiki::Plugins::CompareRevisionsAddonPlugin::initPlugin # spent 20µs making 1 call to Foswiki::Plugins::ModifyLoginPlugin::initPlugin # spent 20µs making 1 call to Foswiki::Plugins::PreferencesPlugin::initPlugin # spent 15µs making 1 call to Foswiki::Plugins::SlideShowPlugin::initPlugin # spent 15µs making 1 call to Foswiki::Plugins::TinyMCEPlugin::initPlugin # spent 5µs making 1 call to Foswiki::Plugins::HomePagePlugin::initPlugin
251 $Foswiki::Plugins::SESSION->{topicName},
252 $Foswiki::Plugins::SESSION->{webName},
253 $users->getLoginName( $Foswiki::Plugins::SESSION->{user} ),
254 $this->topicWeb()
255 );
2562297µs228µs
# spent 19µs (10+9) within Foswiki::Plugin::BEGIN@256 which was called: # once (10µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 256
use strict 'refs';
# spent 19µs making 1 call to Foswiki::Plugin::BEGIN@256 # spent 9µs making 1 call to strict::import
257 }
258 catch Foswiki::AccessControlException with {
259 shift->throw(); # propagate
260 }
261 catch Foswiki::OopsException with {
262 shift->throw(); # propagate
263 }
264 catch Foswiki::ValidationException with {
265 shift->throw(); # propagate
266 }
267 otherwise {
268 my $e = shift;
269 $exception = $e->text() . ' ' . $e->stacktrace();
27042937µs336545µs };
# spent 310µs making 126 calls to Error::catch, avg 2µs/call # spent 120µs making 42 calls to Error::subs::otherwise, avg 3µs/call # spent 115µs making 126 calls to Error::subs::with, avg 913ns/call # spent 59.4ms making 42 calls to Error::subs::try, avg 1.41ms/call, recursion: max depth 1, sum of overlapping time 59.4ms
271
272426µs unless ($status) {
273 if ( !$exception ) {
274 $exception = <<MESSAGE;
275$sub did not return true.
276Check your Foswiki warning and error logs for more information.
277MESSAGE
278 }
279 push( @{ $this->{errors} }, $exception );
280 $this->{disabled} = 1;
281 $this->{reason} = 'plugin_ret_0';
282 return;
283 }
284
285421.02ms my $compat = eval '\%' . $p . '::FoswikiCompatibility';
# spent 5µs executing statements in 2 string evals (merged) # spent 4µs executing statements in 2 string evals (merged) # spent 4µs executing statements in 2 string evals (merged) # spent 4µs executing statements in 2 string evals (merged) # spent 3µs executing statements in string eval # spent 3µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval # spent 2µs executing statements in string eval
2864240µs foreach my $h (@registrableHandlers) {
2871344384µs my $sub = $p . '::' . $h;
28813442.00ms if ( defined(&$sub) ) {
2898747µs19µs if ( $deprecated{$h}
# spent 9µs making 1 call to version::vxs::VCMP
290 && $compat
291 && $compat->{$h}
292 && $compat->{$h} <= $Foswiki::Plugins::VERSION )
293 {
294
295 # Compatibility handler not required in this version
29612µs next;
297 }
29886125µs86198µs $plugins->addListener( $h, $this );
# spent 198µs making 86 calls to Foswiki::Plugins::addListener, avg 2µs/call
299 }
300 }
30142166µs42117µs $this->{session}->enterContext( $this->{name} . 'Enabled' );
# spent 117µs making 42 calls to Foswiki::enterContext, avg 3µs/call
302}
303
304# Invoke a handler
305
# spent 37.7ms (9.64+28.1) within Foswiki::Plugin::invoke which was called 1632 times, avg 23µs/call: # 1632 times (9.64ms+28.1ms) by Foswiki::Plugins::dispatch at line 380 of /var/www/foswikidev/core/lib/Foswiki/Plugins.pm, avg 23µs/call
sub invoke {
3061632311µs my $this = shift; # remove from parameter vector
3071632234µs my $handlerName = shift;
3081632809µs my $handler = $this->{module} . '::' . $handlerName;
309232µs229µs
# spent 18µs (8+10) within Foswiki::Plugin::BEGIN@309 which was called: # once (8µs+10µs) by Foswiki::Plugins::BEGIN@21 at line 309
no strict 'refs';
# spent 18µs making 1 call to Foswiki::Plugin::BEGIN@309 # spent 10µs making 1 call to strict::unimport
31016326.18ms163228.2ms return &$handler(@_);
# spent 11.6ms making 5 calls to Foswiki::Plugins::TablePlugin::preRenderingHandler, avg 2.31ms/call # spent 6.07ms making 5 calls to Foswiki::Plugins::SmiliesPlugin::preRenderingHandler, avg 1.21ms/call # spent 3.13ms making 108 calls to Foswiki::Plugins::DirectedGraphPlugin::commonTagsHandler, avg 29µs/call # spent 627µs making 100 calls to Foswiki::Plugins::WysiwygPlugin::beforeCommonTagsHandler, avg 6µs/call # spent 581µs making 108 calls to Foswiki::Plugins::ChecklistPlugin::commonTagsHandler, avg 5µs/call # spent 576µs making 100 calls to Foswiki::Plugins::TablePlugin::afterCommonTagsHandler, avg 6µs/call # spent 497µs making 5 calls to Foswiki::Plugins::InterwikiPlugin::preRenderingHandler, avg 99µs/call # spent 485µs making 108 calls to Foswiki::Plugins::RevCommentPlugin::commonTagsHandler, avg 4µs/call # spent 438µs making 108 calls to Foswiki::Plugins::CompareRevisionsAddonPlugin::commonTagsHandler, avg 4µs/call # spent 425µs making 5 calls to Foswiki::Plugins::ChecklistPlugin::endRenderingHandler, avg 85µs/call # spent 425µs making 108 calls to Foswiki::Plugins::RenderFormPlugin::commonTagsHandler, avg 4µs/call # spent 418µs making 108 calls to Foswiki::Plugins::ActionTrackerPlugin::commonTagsHandler, avg 4µs/call # spent 370µs making 108 calls to Foswiki::Plugins::SpreadSheetPlugin::commonTagsHandler, avg 3µs/call # spent 370µs making 100 calls to Foswiki::Plugins::AttachContentPlugin::beforeCommonTagsHandler, avg 4µs/call # spent 353µs making 108 calls to Foswiki::Plugins::ChartPlugin::commonTagsHandler, avg 3µs/call # spent 338µs making 108 calls to Foswiki::Plugins::EditTablePlugin::commonTagsHandler, avg 3µs/call # spent 320µs making 100 calls to Foswiki::Plugins::PreferencesPlugin::beforeCommonTagsHandler, avg 3µs/call # spent 313µs making 100 calls to Foswiki::Plugins::EditTablePlugin::beforeCommonTagsHandler, avg 3µs/call # spent 288µs making 108 calls to Foswiki::Plugins::SlideShowPlugin::commonTagsHandler, avg 3µs/call # spent 200µs making 5 calls to Foswiki::Plugins::ChecklistPlugin::postRenderingHandler, avg 40µs/call # spent 169µs making 1 call to Foswiki::Plugins::JQueryPlugin::finishPlugin # spent 69µs making 5 calls to Foswiki::Plugins::EditTablePlugin::postRenderingHandler, avg 14µs/call # spent 66µs making 5 calls to Foswiki::Plugins::PreferencesPlugin::postRenderingHandler, avg 13µs/call # spent 37µs making 1 call to Foswiki::Plugins::WysiwygPlugin::modifyHeaderHandler # spent 35µs making 5 calls to Foswiki::Plugins::FindElsewherePlugin::Core::preRenderingHandler, avg 7µs/call # spent 32µs making 5 calls to Foswiki::Plugins::RenderListPlugin::preRenderingHandler, avg 6µs/call # spent 19µs making 5 calls to Foswiki::Plugins::WysiwygPlugin::postRenderingHandler, avg 4µs/call
311244µs224µs
# spent 15µs (7+9) within Foswiki::Plugin::BEGIN@311 which was called: # once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 311
use strict 'refs';
# spent 15µs making 1 call to Foswiki::Plugin::BEGIN@311 # spent 8µs making 1 call to strict::import
312}
313
314# Get the VERSION number of the specified plugin.
315# SMELL: may die if the plugin doesn't compile
316sub getVersion {
317 my $this = shift;
318
319233µs226µs
# spent 16µs (7+9) within Foswiki::Plugin::BEGIN@319 which was called: # once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 319
no strict 'refs';
# spent 16µs making 1 call to Foswiki::Plugin::BEGIN@319 # spent 9µs making 1 call to strict::unimport
320 return ${ $this->{module} . '::VERSION' } || '';
321245µs224µs
# spent 15µs (7+8) within Foswiki::Plugin::BEGIN@321 which was called: # once (7µs+8µs) by Foswiki::Plugins::BEGIN@21 at line 321
use strict 'refs';
# spent 15µs making 1 call to Foswiki::Plugin::BEGIN@321 # spent 8µs making 1 call to strict::import
322}
323
324# Get the RELEASE of the specified plugin.
325# SMELL: may die if the plugin doesn't compile
326sub getRelease {
327 my $this = shift;
328
329232µs224µs
# spent 16µs (7+9) within Foswiki::Plugin::BEGIN@329 which was called: # once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 329
no strict 'refs';
# spent 16µs making 1 call to Foswiki::Plugin::BEGIN@329 # spent 9µs making 1 call to strict::unimport
330 return ${ $this->{module} . '::RELEASE' } || '';
3312340µs223µs
# spent 15µs (7+8) within Foswiki::Plugin::BEGIN@331 which was called: # once (7µs+8µs) by Foswiki::Plugins::BEGIN@21 at line 331
use strict 'refs';
# spent 15µs making 1 call to Foswiki::Plugin::BEGIN@331 # spent 8µs making 1 call to strict::import
332}
333
334# Get the description string for the given plugin
335sub getDescription {
336 my $this = shift;
337
338 unless ( defined $this->{description} ) {
339 my $pref = uc( $this->{name} ) . '_SHORTDESCRIPTION';
340 my $prefs = $this->{session}->{prefs};
341 $this->{description} = $prefs->getPreference($pref) || '';
342 }
343 if ( $this->{disabled} ) {
344 my $reason = '';
345 if ( $this->{reason} ) {
346 $reason =
347 $this->{session}->inlineAlert( 'alerts', $this->{reason} );
348 }
349 return
350 ' '
351 . $this->{name} . ': '
352 . $this->{session}->inlineAlert( 'alerts', 'plugin_disabled' )
353 . $reason;
354 }
355
356 my $release = $this->getRelease();
357 my $version = $this->getVersion();
358 $version =~ s/\$Rev: (\d+) \$/$1/g;
359 $version = $release . ', ' . $version if $release;
360
361 my $web = $this->topicWeb();
362 my $result = ' ' . ( $web ? "$web." : '!' ) . $this->{name} . ' ';
363 $result .= CGI::span( { class => 'foswikiGrayText foswikiSmall' },
364 '(' . $version . ')' );
365 $result .= ': ' . $this->{description};
366 return $result;
367}
368
369=begin TML
370
371---++ ObjectMethod topicWeb() -> $webname
372
373Find the web that has the topic for this plugin by searching the
374{Plugins}{WebSearchPath}. Returns undef if $NO_PREFS_IN_TOPIC=1
375
376=cut
377
378
# spent 801µs (219+582) within Foswiki::Plugin::topicWeb which was called 56 times, avg 14µs/call: # 42 times (91µs+0s) by Foswiki::Plugin::__ANON__[/var/www/foswikidev/core/lib/Foswiki/Plugin.pm:257] at line 250, avg 2µs/call # 7 times (117µs+582µs) by Foswiki::Plugin::load at line 166, avg 100µs/call # 7 times (12µs+0s) by Foswiki::Plugin::registerSettings at line 232, avg 2µs/call
sub topicWeb {
3795614µs my $this = shift;
380
3815643µs unless ( defined( $this->{topicWeb} ) || $this->{no_topic} ) {
382
383 # Find the plugin topic, if required
38472µs my $session = $this->{session};
385
386726µs foreach
387 my $web ( split( /[, ]+/, $Foswiki::cfg{Plugins}{WebSearchPath} ),
388 $session->{webName} )
389 {
390712µs735µs $web = Foswiki::Sandbox::untaintUnchecked($web); # Item11953
# spent 35µs making 7 calls to Foswiki::Sandbox::untaintUnchecked, avg 5µs/call
391714µs7547µs if ( $session->topicExists( $web, $this->{name} ) ) {
# spent 547µs making 7 calls to Foswiki::topicExists, avg 78µs/call
39275µs $this->{topicWeb} = $web;
39376µs last;
394 }
395 }
396 }
397
398 # If there is no web (probably because NO_PREFS_IN_TOPIC is set)
399 # then default to the system web name.
40056142µs return $this->{topicWeb} || $Foswiki::cfg{SystemWebName};
401}
402
40316µs1;
404__END__