Filename | /var/www/foswiki11/lib/Foswiki/Plugin.pm |
Statements | Executed 5481 statements in 21.8ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
37 | 1 | 1 | 9.97ms | 92.2ms | load | Foswiki::Plugin::
37 | 1 | 1 | 6.42ms | 49.3ms | registerHandlers | Foswiki::Plugin::
238 | 1 | 1 | 1.52ms | 38.5ms | invoke (recurses: max depth 1, inclusive time 381µs) | Foswiki::Plugin::
1 | 1 | 1 | 777µs | 851µs | BEGIN@15 | Foswiki::Plugin::
36 | 1 | 1 | 520µs | 41.3ms | __ANON__[:241] | Foswiki::Plugin::
37 | 1 | 1 | 358µs | 386µs | new | Foswiki::Plugin::
37 | 1 | 1 | 343µs | 1.30s | registerSettings | Foswiki::Plugin::
37 | 1 | 1 | 316µs | 316µs | finish | Foswiki::Plugin::
1 | 1 | 1 | 308µs | 358µs | BEGIN@14 | Foswiki::Plugin::
50 | 3 | 1 | 268µs | 784µs | topicWeb | Foswiki::Plugin::
1 | 1 | 1 | 217µs | 261µs | BEGIN@16 | Foswiki::Plugin::
1 | 1 | 1 | 12µs | 25µs | BEGIN@8 | Foswiki::Plugin::
1 | 1 | 1 | 11µs | 23µs | BEGIN@10 | Foswiki::Plugin::
1 | 1 | 1 | 9µs | 22µs | BEGIN@181 | Foswiki::Plugin::
1 | 1 | 1 | 9µs | 14µs | BEGIN@9 | Foswiki::Plugin::
1 | 1 | 1 | 8µs | 119µs | BEGIN@11 | Foswiki::Plugin::
1 | 1 | 1 | 8µs | 19µs | BEGIN@293 | Foswiki::Plugin::
1 | 1 | 1 | 8µs | 18µs | BEGIN@233 | Foswiki::Plugin::
1 | 1 | 1 | 8µs | 17µs | BEGIN@195 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 16µs | BEGIN@183 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 16µs | BEGIN@313 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 16µs | BEGIN@201 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 16µs | BEGIN@303 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 15µs | BEGIN@240 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 16µs | BEGIN@315 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 15µs | BEGIN@295 | Foswiki::Plugin::
1 | 1 | 1 | 7µs | 15µs | BEGIN@305 | Foswiki::Plugin::
1 | 1 | 1 | 4µs | 4µs | BEGIN@13 | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | __ANON__[:244] | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | __ANON__[:247] | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | __ANON__[:250] | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | __ANON__[:254] | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | getDescription | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | getRelease | Foswiki::Plugin::
0 | 0 | 0 | 0s | 0s | getVersion | Foswiki::Plugin::
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. | ||||
6 | package Foswiki::Plugin; | ||||
7 | |||||
8 | 2 | 25µs | 2 | 38µs | # spent 25µs (12+13) within Foswiki::Plugin::BEGIN@8 which was called:
# once (12µs+13µs) by Foswiki::Plugins::BEGIN@21 at line 8 # spent 25µs making 1 call to Foswiki::Plugin::BEGIN@8
# spent 13µs making 1 call to strict::import |
9 | 2 | 23µs | 2 | 20µs | # spent 14µs (9+6) within Foswiki::Plugin::BEGIN@9 which was called:
# once (9µs+6µs) by Foswiki::Plugins::BEGIN@21 at line 9 # spent 14µs making 1 call to Foswiki::Plugin::BEGIN@9
# spent 6µs making 1 call to warnings::import |
10 | 2 | 27µs | 2 | 34µs | # spent 23µs (11+12) within Foswiki::Plugin::BEGIN@10 which was called:
# once (11µs+12µs) by Foswiki::Plugins::BEGIN@21 at line 10 # spent 23µs making 1 call to Foswiki::Plugin::BEGIN@10
# spent 12µs making 1 call to Assert::import |
11 | 2 | 29µs | 2 | 230µs | # spent 119µs (8+111) within Foswiki::Plugin::BEGIN@11 which was called:
# once (8µs+111µs) by Foswiki::Plugins::BEGIN@21 at line 11 # spent 119µs making 1 call to Foswiki::Plugin::BEGIN@11
# spent 111µs making 1 call to Error::import |
12 | |||||
13 | 2 | 20µs | 1 | 4µs | # spent 4µs within Foswiki::Plugin::BEGIN@13 which was called:
# once (4µs+0s) by Foswiki::Plugins::BEGIN@21 at line 13 # spent 4µs making 1 call to Foswiki::Plugin::BEGIN@13 |
14 | 2 | 145µs | 1 | 358µs | # spent 358µs (308+50) within Foswiki::Plugin::BEGIN@14 which was called:
# once (308µs+50µs) by Foswiki::Plugins::BEGIN@21 at line 14 # spent 358µs making 1 call to Foswiki::Plugin::BEGIN@14 |
15 | 2 | 135µs | 1 | 851µs | # spent 851µs (777+74) within Foswiki::Plugin::BEGIN@15 which was called:
# once (777µs+74µs) by Foswiki::Plugins::BEGIN@21 at line 15 # spent 851µs making 1 call to Foswiki::Plugin::BEGIN@15 |
16 | 2 | 522µs | 1 | 261µs | # spent 261µs (217+44) within Foswiki::Plugin::BEGIN@16 which was called:
# once (217µs+44µs) by Foswiki::Plugins::BEGIN@21 at line 16 # spent 261µs making 1 call to Foswiki::Plugin::BEGIN@16 |
17 | |||||
18 | 1 | 5µs | our @registrableHandlers = ( # Foswiki::Plugins::VERSION: | ||
19 | 'afterAttachmentSaveHandler', # 1.022 DEPRECATED | ||||
20 | 'afterUploadHandler', # 2.1 | ||||
21 | 'afterCommonTagsHandler', # 1.024 | ||||
22 | 'afterEditHandler', # 1.010 | ||||
23 | 'afterRenameHandler', # 1.110 | ||||
24 | 'afterSaveHandler', # 1.020 | ||||
25 | 'beforeAttachmentSaveHandler', # 1.022 DEPRECATED | ||||
26 | 'beforeCommonTagsHandler', # 1.024 | ||||
27 | 'beforeEditHandler', # 1.010 | ||||
28 | 'beforeMergeHandler', # 1.200 | ||||
29 | 'beforeSaveHandler', # 1.010 | ||||
30 | 'beforeUploadHandler', # 2.1 | ||||
31 | 'commonTagsHandler', # 1.000 | ||||
32 | 'completePageHandler', # 1.100 | ||||
33 | 'earlyInitPlugin', # 1.020 | ||||
34 | 'endRenderingHandler', # 1.000 DEPRECATED | ||||
35 | 'finishPlugin', # 2.100 | ||||
36 | 'initPlugin', # 1.000 | ||||
37 | 'initializeUserHandler', # 1.010 | ||||
38 | 'insidePREHandler', # 1.000 DEPRECATED | ||||
39 | 'modifyHeaderHandler', # 1.026 | ||||
40 | 'mergeHandler', # 1.026 | ||||
41 | 'outsidePREHandler', # 1.000 DEPRECATED | ||||
42 | 'postRenderingHandler', # 1.026 | ||||
43 | 'preRenderingHandler', # 1.026 | ||||
44 | 'redirectCgiQueryHandler', # 1.010 DEPRECATED | ||||
45 | 'registrationHandler', # 1.010 | ||||
46 | 'renderFormFieldForEditHandler', # ? | ||||
47 | 'renderWikiWordHandler', # 1.023 | ||||
48 | 'startRenderingHandler', # 1.000 DEPRECATED | ||||
49 | 'writeHeaderHandler', # 1.010 DEPRECATED | ||||
50 | ); | ||||
51 | |||||
52 | # deprecated handlers | ||||
53 | 1 | 4µs | our %deprecated = ( | ||
54 | afterAttachmentSaveHandler => 1, | ||||
55 | beforeAttachmentSaveHandler => 1, | ||||
56 | endRenderingHandler => 1, | ||||
57 | insidePREHandler => 1, | ||||
58 | outsidePREHandler => 1, | ||||
59 | redirectCgiQueryHandler => 1, | ||||
60 | startRenderingHandler => 1, | ||||
61 | writeHeaderHandler => 1, | ||||
62 | ); | ||||
63 | |||||
64 | =begin TML | ||||
65 | |||||
66 | ---++ ClassMethod new( $session, $name, [, $module] ) | ||||
67 | |||||
68 | * =$session= - Foswiki object | ||||
69 | * =$name= - name of the plugin e.g. MyPlugin | ||||
70 | * =$module= - name of implementing package; optional, used for tests. | ||||
71 | Normally =load= is used to discover the module from the config. | ||||
72 | |||||
73 | =cut | ||||
74 | |||||
75 | # spent 386µs (358+28) within Foswiki::Plugin::new which was called 37 times, avg 10µs/call:
# 37 times (358µs+28µs) by Foswiki::Plugins::load at line 186 of /var/www/foswiki11/lib/Foswiki/Plugins.pm, avg 10µs/call | ||||
76 | 37 | 37µs | my ( $class, $session, $name, $module ) = @_; | ||
77 | 37 | 32µs | 37 | 28µs | ASSERT( UNTAINTED($name), "Name $name is tainted!" ) if DEBUG; # spent 28µs making 37 calls to Assert::ASSERTS_OFF, avg 751ns/call |
78 | 37 | 177µs | my $this = bless( | ||
79 | { | ||||
80 | session => $session, | ||||
81 | name => $name || '', | ||||
82 | module => $module, # if undef, use discovery | ||||
83 | }, | ||||
84 | $class | ||||
85 | ); | ||||
86 | |||||
87 | 37 | 89µs | return $this; | ||
88 | } | ||||
89 | |||||
90 | =begin TML | ||||
91 | |||||
92 | ---++ ObjectMethod finish() | ||||
93 | Break circular references. | ||||
94 | |||||
95 | =cut | ||||
96 | |||||
97 | # Note to developers; please undef *all* fields in the object explicitly, | ||||
98 | # whether they are references or not. That way this method is "golden | ||||
99 | # documentation" of the live fields in the object. | ||||
100 | # spent 316µs within Foswiki::Plugin::finish which was called 37 times, avg 9µs/call:
# 37 times (316µs+0s) by Foswiki::Plugins::finish at line 102 of /var/www/foswiki11/lib/Foswiki/Plugins.pm, avg 9µs/call | ||||
101 | 37 | 9µs | my $this = shift; | ||
102 | |||||
103 | 37 | 45µs | undef $this->{name}; | ||
104 | 37 | 25µs | undef $this->{topicWeb}; | ||
105 | 37 | 41µs | undef $this->{module}; | ||
106 | 37 | 36µs | undef $this->{errors}; | ||
107 | 37 | 44µs | undef $this->{disabled}; | ||
108 | 37 | 13µs | undef $this->{reason}; | ||
109 | 37 | 20µs | undef $this->{no_topic}; | ||
110 | 37 | 42µs | undef $this->{description}; | ||
111 | 37 | 78µs | undef $this->{session}; | ||
112 | } | ||||
113 | |||||
114 | # Load and verify a plugin, invoking any early registration | ||||
115 | # handlers. Return the user resulting from the user handler call. | ||||
116 | # spent 92.2ms (9.97+82.2) within Foswiki::Plugin::load which was called 37 times, avg 2.49ms/call:
# 37 times (9.97ms+82.2ms) by Foswiki::Plugins::load at line 190 of /var/www/foswiki11/lib/Foswiki/Plugins.pm, avg 2.49ms/call | ||||
117 | 37 | 17µs | my ($this) = @_; | ||
118 | 37 | 55µs | my $p = $Foswiki::cfg{Plugins}{ $this->{name} }{Module}; | ||
119 | |||||
120 | 37 | 13µs | if ( defined $p ) { | ||
121 | 37 | 1.16ms | eval "use $p"; # spent 222µs executing statements in 2 string evals (merged) # includes 1.76ms spent executing 2 calls to 2 subs defined therein. # spent 189µs executing statements in 2 string evals (merged) # includes 2.50ms spent executing 2 calls to 2 subs defined therein. # spent 130µs executing statements in string eval # includes 7.36ms spent executing 1 call to 1 sub defined therein. # spent 114µs executing statements in string eval # includes 763µs spent executing 1 call to 1 sub defined therein. # spent 111µs executing statements in string eval # includes 643µs spent executing 1 call to 1 sub defined therein. # spent 109µs executing statements in string eval # includes 390µs spent executing 1 call to 1 sub defined therein. # spent 106µs executing statements in string eval # includes 2.64ms spent executing 1 call to 1 sub defined therein. # spent 105µs executing statements in string eval # includes 5.50ms spent executing 1 call to 1 sub defined therein. # spent 102µs executing statements in string eval # includes 1.64ms spent executing 1 call to 1 sub defined therein. # spent 102µs executing statements in string eval # includes 763µs spent executing 1 call to 1 sub defined therein. # spent 99µs executing statements in string eval # includes 1.58ms spent executing 1 call to 1 sub defined therein. # spent 99µs executing statements in string eval # includes 924µs spent executing 1 call to 1 sub defined therein. # spent 97µs executing statements in string eval # includes 2.11ms spent executing 1 call to 1 sub defined therein. # spent 96µs executing statements in string eval # includes 1.43ms spent executing 1 call to 1 sub defined therein. # spent 96µs executing statements in string eval # includes 509µs spent executing 1 call to 1 sub defined therein. # spent 95µs executing statements in string eval # includes 1.01ms spent executing 1 call to 1 sub defined therein. # spent 95µs executing statements in string eval # includes 2.56ms spent executing 1 call to 1 sub defined therein. # spent 95µs executing statements in string eval # includes 479µs spent executing 1 call to 1 sub defined therein. # spent 94µs executing statements in string eval # includes 1.33ms spent executing 1 call to 1 sub defined therein. # spent 94µs executing statements in string eval # includes 1.79ms spent executing 1 call to 1 sub defined therein. # spent 92µs executing statements in string eval # includes 250µs spent executing 1 call to 1 sub defined therein. # spent 92µs executing statements in string eval # includes 835µs spent executing 1 call to 1 sub defined therein. # spent 91µs executing statements in string eval # includes 1.57ms spent executing 1 call to 1 sub defined therein. # spent 89µs executing statements in string eval # includes 358µs spent executing 1 call to 1 sub defined therein. # spent 88µs executing statements in string eval # includes 1.08ms spent executing 1 call to 1 sub defined therein. # spent 87µs executing statements in string eval # includes 1.40ms spent executing 1 call to 1 sub defined therein. # spent 87µs executing statements in string eval # includes 2.77ms spent executing 1 call to 1 sub defined therein. # spent 86µs executing statements in string eval # includes 2.08ms spent executing 1 call to 1 sub defined therein. # spent 85µs executing statements in string eval # includes 447µs spent executing 1 call to 1 sub defined therein. # spent 85µs executing statements in string eval # includes 1.04ms spent executing 1 call to 1 sub defined therein. # spent 84µs executing statements in string eval # includes 376µs spent executing 1 call to 1 sub defined therein. # spent 83µs executing statements in string eval # includes 220µs spent executing 1 call to 1 sub defined therein. # spent 82µs executing statements in string eval # includes 666µs spent executing 1 call to 1 sub defined therein. # spent 80µs executing statements in string eval # includes 374µs spent executing 1 call to 1 sub defined therein. # spent 78µs executing statements in string eval # includes 222µs spent executing 1 call to 1 sub defined therein. | ||
122 | 37 | 16µs | if ($@) { | ||
123 | push( | ||||
124 | 1 | 6µs | @{ $this->{errors} }, | ||
125 | "$p could not be loaded. Errors were:\n$@\n----" | ||||
126 | ); | ||||
127 | 1 | 1µs | $this->{disabled} = 1; | ||
128 | 1 | 2µs | $this->{reason} = 'no_load_plugin'; | ||
129 | 1 | 3µs | return; | ||
130 | } | ||||
131 | else { | ||||
132 | 36 | 44µs | $this->{module} = $p; | ||
133 | } | ||||
134 | } | ||||
135 | else { | ||||
136 | push( | ||||
137 | @{ $this->{errors} }, | ||||
138 | "$this->{name} could not be loaded. No \$Foswiki::cfg{Plugins}{$this->{name}}{Module} defined - re-run configure\n---" | ||||
139 | ); | ||||
140 | $this->{disabled} = 1; | ||||
141 | $this->{reason} = 'no_plugin_module'; | ||||
142 | return; | ||||
143 | } | ||||
144 | |||||
145 | 36 | 690µs | my $noTopic = eval '$' . $p . '::NO_PREFS_IN_TOPIC'; # spent 8µ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 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 | ||
146 | 36 | 28µs | $this->{no_topic} = $noTopic; | ||
147 | 36 | 17µs | $this->{topicWeb} = undef; # not known yet | ||
148 | |||||
149 | 36 | 9µs | unless ($noTopic) { | ||
150 | 7 | 25µs | 7 | 601µs | if ( !$this->topicWeb() ) { # spent 601µs making 7 calls to Foswiki::Plugin::topicWeb, avg 86µs/call |
151 | |||||
152 | # not found | ||||
153 | push( | ||||
154 | @{ $this->{errors} }, | ||||
155 | 'Plugins: could not fully register ' | ||||
156 | . $this->{name} | ||||
157 | . ', no plugin topic' | ||||
158 | ); | ||||
159 | $noTopic = 1; | ||||
160 | } | ||||
161 | } | ||||
162 | |||||
163 | # Get the description from the code, if present. if it's not there, it'll | ||||
164 | # be loaded as a preference from the plugin topic later | ||||
165 | 36 | 535µs | $this->{description} = eval '$' . $p . '::SHORTDESCRIPTION'; # 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 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 | ||
166 | |||||
167 | # Set the session for this call stack | ||||
168 | 36 | 24µs | local $Foswiki::Plugins::SESSION = $this->{session}; | ||
169 | 36 | 67µs | 36 | 59µs | ASSERT( $Foswiki::Plugins::SESSION->isa('Foswiki') ) if DEBUG; # spent 59µs making 36 calls to Assert::ASSERTS_OFF, avg 2µs/call |
170 | |||||
171 | 36 | 20µs | my $sub = $p . "::initPlugin"; | ||
172 | 36 | 41µs | if ( !defined(&$sub) ) { | ||
173 | push( @{ $this->{errors} }, $sub . ' is not defined' ); | ||||
174 | $this->{disabled} = 1; | ||||
175 | $this->{reason} = 'no_initPlugin'; | ||||
176 | return; | ||||
177 | } | ||||
178 | |||||
179 | 36 | 8µs | $sub = $p . '::earlyInitPlugin'; | ||
180 | 36 | 81µs | if ( defined(&$sub) ) { | ||
181 | 2 | 34µs | 2 | 34µs | # spent 22µs (9+12) within Foswiki::Plugin::BEGIN@181 which was called:
# once (9µs+12µs) by Foswiki::Plugins::BEGIN@21 at line 181 # spent 22µs making 1 call to Foswiki::Plugin::BEGIN@181
# spent 12µs making 1 call to strict::unimport |
182 | my $error = &$sub(); | ||||
183 | 2 | 72µs | 2 | 25µs | # spent 16µs (7+9) within Foswiki::Plugin::BEGIN@183 which was called:
# once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 183 # spent 16µs making 1 call to Foswiki::Plugin::BEGIN@183
# spent 9µs making 1 call to strict::import |
184 | if ($error) { | ||||
185 | push( @{ $this->{errors} }, $sub . ' failed: ' . $error ); | ||||
186 | $this->{disabled} = 1; | ||||
187 | $this->{reason} = 'no_earlyInitPlugin'; | ||||
188 | return; | ||||
189 | } | ||||
190 | } | ||||
191 | |||||
192 | 36 | 4µs | my $user; | ||
193 | 36 | 9µs | $sub = $p . '::initializeUserHandler'; | ||
194 | 36 | 49µs | if ( defined(&$sub) ) { | ||
195 | 2 | 44µs | 2 | 27µs | # spent 17µs (8+10) within Foswiki::Plugin::BEGIN@195 which was called:
# once (8µs+10µs) by Foswiki::Plugins::BEGIN@21 at line 195 # spent 17µs making 1 call to Foswiki::Plugin::BEGIN@195
# spent 10µs making 1 call to strict::unimport |
196 | 1 | 12µs | 3 | 194µs | $user = &$sub( # spent 184µs making 1 call to Foswiki::Request::url
# spent 9µs making 1 call to Foswiki::Plugins::ModifyLoginPlugin::initializeUserHandler
# spent 2µs making 1 call to Foswiki::Request::pathInfo |
197 | $this->{session}->{remoteUser}, | ||||
198 | $this->{session}->{request}->url(), | ||||
199 | $this->{session}->{request}->path_info() | ||||
200 | ); | ||||
201 | 2 | 195µs | 2 | 24µs | # spent 16µs (7+8) within Foswiki::Plugin::BEGIN@201 which was called:
# once (7µs+8µs) by Foswiki::Plugins::BEGIN@21 at line 201 # spent 16µs making 1 call to Foswiki::Plugin::BEGIN@201
# spent 8µs making 1 call to strict::import |
202 | } | ||||
203 | |||||
204 | #print STDERR "Compile $p: ".timestr(timediff(new Benchmark, $begin))."\n"; | ||||
205 | |||||
206 | 36 | 104µs | return $user; | ||
207 | } | ||||
208 | |||||
209 | # register plugin settings | ||||
210 | # spent 1.30s (343µs+1.30) within Foswiki::Plugin::registerSettings which was called 37 times, avg 35.1ms/call:
# 37 times (343µs+1.30s) by Foswiki::Plugins::settings at line 234 of /var/www/foswiki11/lib/Foswiki/Plugins.pm, avg 35.1ms/call | ||||
211 | 37 | 46µs | my ( $this, $plugins ) = @_; | ||
212 | |||||
213 | 37 | 36µs | return if $this->{disabled}; | ||
214 | |||||
215 | 36 | 40µs | my $prefs = $this->{session}->{prefs}; | ||
216 | 36 | 287µs | 14 | 1.30s | if ( !$this->{no_topic} ) { # spent 1.30s making 7 calls to Foswiki::Prefs::setPluginPreferences, avg 185ms/call
# spent 66µs making 7 calls to Foswiki::Plugin::topicWeb, avg 9µs/call |
217 | $prefs->setPluginPreferences( $this->topicWeb(), $this->{name} ); | ||||
218 | } | ||||
219 | } | ||||
220 | |||||
221 | # invoke plugin initialisation and register handlers. | ||||
222 | # spent 49.3ms (6.42+42.8) within Foswiki::Plugin::registerHandlers which was called 37 times, avg 1.33ms/call:
# 37 times (6.42ms+42.8ms) by Foswiki::Plugins::enable at line 268 of /var/www/foswiki11/lib/Foswiki/Plugins.pm, avg 1.33ms/call | ||||
223 | 37 | 26µs | my ( $this, $plugins ) = @_; | ||
224 | |||||
225 | 37 | 19µs | return if $this->{disabled}; | ||
226 | |||||
227 | 36 | 28µs | my $p = $this->{module}; | ||
228 | 36 | 17µs | my $sub = $p . "::initPlugin"; | ||
229 | 36 | 19µs | my $users = $Foswiki::Plugins::SESSION->{users}; | ||
230 | 36 | 7µs | my $status = 0; | ||
231 | 36 | 7µs | my $exception = ''; | ||
232 | # spent 41.3ms (520µs+40.7) within Foswiki::Plugin::__ANON__[/var/www/foswiki11/lib/Foswiki/Plugin.pm:241] which was called 36 times, avg 1.15ms/call:
# 36 times (520µs+40.7ms) by Error::subs::try at line 419 of Error.pm, avg 1.15ms/call | ||||
233 | 2 | 50µs | 2 | 28µs | # spent 18µs (8+10) within Foswiki::Plugin::BEGIN@233 which was called:
# once (8µs+10µs) by Foswiki::Plugins::BEGIN@21 at line 233 # spent 18µs making 1 call to Foswiki::Plugin::BEGIN@233
# spent 10µs making 1 call to strict::unimport |
234 | 36 | 532µs | 108 | 40.7ms | $status = &$sub( # spent 15.9ms making 1 call to Foswiki::Plugins::DirectedGraphPlugin::initPlugin
# spent 9.13ms making 1 call to Foswiki::Plugins::SmiliesPlugin::initPlugin
# spent 4.42ms making 1 call to Foswiki::Plugins::JQueryPlugin::initPlugin
# spent 3.21ms making 1 call to Foswiki::Plugins::ActionTrackerPlugin::initPlugin
# spent 3.11ms making 1 call to Foswiki::Plugins::InterwikiPlugin::initPlugin
# spent 1.01ms making 1 call to Foswiki::Plugins::AutoViewTemplatePlugin::initPlugin
# spent 350µs making 1 call to Foswiki::Plugins::TwistyPlugin::initPlugin
# spent 312µs making 1 call to Foswiki::Plugins::PlantUMLPlugin::initPlugin
# spent 251µs making 1 call to Foswiki::Plugins::WysiwygPlugin::initPlugin
# spent 249µs making 1 call to Foswiki::Plugins::ChecklistPlugin::initPlugin
# spent 237µs making 1 call to Foswiki::Plugins::SpreadSheetPlugin::initPlugin
# spent 223µs making 1 call to Foswiki::Plugins::MultiTopicSavePlugin::initPlugin
# spent 212µs making 1 call to Foswiki::Plugins::RevCommentPlugin::initPlugin
# spent 188µs making 1 call to Foswiki::Plugins::ChartPlugin::initPlugin
# spent 183µs making 1 call to Foswiki::Plugins::EditTablePlugin::initPlugin
# spent 143µs making 1 call to Foswiki::Plugins::RenderPlugin::initPlugin
# spent 142µs making 1 call to Foswiki::Plugins::RevisionLinkPlugin::initPlugin
# spent 134µs making 1 call to Foswiki::Plugins::TimeCalcPlugin::initPlugin
# spent 128µs making 1 call to Foswiki::Plugins::AttachContentPlugin::initPlugin
# spent 123µs making 36 calls to Foswiki::Users::getLoginName, avg 3µs/call
# spent 118µs making 36 calls to Foswiki::Plugin::topicWeb, avg 3µs/call
# spent 114µs making 1 call to Foswiki::Plugins::DelayMacroPlugin::initPlugin
# spent 106µs making 1 call to Foswiki::Plugins::JHotDrawPlugin::initPlugin
# spent 104µs making 1 call to Foswiki::Plugins::ExpandTopicContentPlugin::initPlugin
# spent 74µs making 1 call to Foswiki::Plugins::TinyMCEPlugin::initPlugin
# spent 72µs making 1 call to Foswiki::Plugins::FindElsewherePlugin::initPlugin
# spent 70µs making 1 call to Foswiki::Plugins::ExtendedWebListPlugin::initPlugin
# spent 64µs making 1 call to Foswiki::Plugins::HistoryPlugin::initPlugin
# spent 63µs making 1 call to Foswiki::Plugins::TablePlugin::initPlugin
# spent 49µs making 1 call to Foswiki::Plugins::RenderListPlugin::initPlugin
# spent 42µs making 1 call to Foswiki::Plugins::HolidaylistPlugin::initPlugin
# spent 42µs making 1 call to Foswiki::Plugins::MailerContribPlugin::initPlugin
# spent 38µs making 1 call to Foswiki::Plugins::CompareRevisionsAddonPlugin::initPlugin
# spent 34µs making 1 call to Foswiki::Plugins::PreferencesPlugin::initPlugin
# spent 27µs making 1 call to Foswiki::Plugins::ModifyLoginPlugin::initPlugin
# spent 26µs making 1 call to Foswiki::Plugins::SetFormValuesPlugin::initPlugin
# spent 22µs making 1 call to Foswiki::Plugins::SlideShowPlugin::initPlugin
# spent 8µs making 1 call to Foswiki::Plugins::CommentPlugin::initPlugin |
235 | $Foswiki::Plugins::SESSION->{topicName}, | ||||
236 | $Foswiki::Plugins::SESSION->{webName}, | ||||
237 | $users->getLoginName( $Foswiki::Plugins::SESSION->{user} ), | ||||
238 | $this->topicWeb() | ||||
239 | ); | ||||
240 | 2 | 306µs | 2 | 23µs | # spent 15µs (7+8) within Foswiki::Plugin::BEGIN@240 which was called:
# once (7µs+8µs) by Foswiki::Plugins::BEGIN@21 at line 240 # spent 15µs making 1 call to Foswiki::Plugin::BEGIN@240
# spent 8µs making 1 call to strict::import |
241 | } | ||||
242 | catch Foswiki::AccessControlException with { | ||||
243 | shift->throw(); # propagate | ||||
244 | } | ||||
245 | catch Foswiki::OopsException with { | ||||
246 | shift->throw(); # propagate | ||||
247 | } | ||||
248 | catch Foswiki::ValidationException with { | ||||
249 | shift->throw(); # propagate | ||||
250 | } | ||||
251 | otherwise { | ||||
252 | my $e = shift; | ||||
253 | $exception = $e->text() . ' ' . $e->stacktrace(); | ||||
254 | 36 | 1.13ms | 288 | 679µs | }; # spent 396µs making 108 calls to Error::catch, avg 4µs/call
# spent 147µs making 36 calls to Error::subs::otherwise, avg 4µs/call
# spent 137µs making 108 calls to Error::subs::with, avg 1µs/call
# spent 41.7ms making 36 calls to Error::subs::try, avg 1.16ms/call, recursion: max depth 1, sum of overlapping time 41.7ms |
255 | |||||
256 | 36 | 7µs | unless ($status) { | ||
257 | if ( !$exception ) { | ||||
258 | $exception = <<MESSAGE; | ||||
259 | $sub did not return true. | ||||
260 | Check your Foswiki warning and error logs for more information. | ||||
261 | MESSAGE | ||||
262 | } | ||||
263 | push( @{ $this->{errors} }, $exception ); | ||||
264 | $this->{disabled} = 1; | ||||
265 | $this->{reason} = 'plugin_ret_0'; | ||||
266 | return; | ||||
267 | } | ||||
268 | |||||
269 | 36 | 1.40ms | my $compat = eval '\%' . $p . '::FoswikiCompatibility'; # spent 6µs executing statements in 2 string evals (merged)
# spent 6µs executing statements in 2 string evals (merged)
# spent 5µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 4µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# spent 3µs executing statements in string eval
# 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 | ||
270 | 36 | 44µs | foreach my $h (@registrableHandlers) { | ||
271 | 1116 | 428µs | my $sub = $p . '::' . $h; | ||
272 | 1116 | 2.31ms | if ( defined(&$sub) ) { | ||
273 | 81 | 75µs | 2 | 20µs | if ( $deprecated{$h} # spent 20µs making 2 calls to version::vxs::VCMP, avg 10µs/call |
274 | && $compat | ||||
275 | && $compat->{$h} | ||||
276 | && $compat->{$h} <= $Foswiki::Plugins::VERSION ) | ||||
277 | { | ||||
278 | |||||
279 | # Compatibility handler not required in this version | ||||
280 | 2 | 4µs | next; | ||
281 | } | ||||
282 | 79 | 159µs | 79 | 260µs | $plugins->addListener( $h, $this ); # spent 260µs making 79 calls to Foswiki::Plugins::addListener, avg 3µs/call |
283 | } | ||||
284 | } | ||||
285 | 36 | 192µs | 36 | 154µs | $this->{session}->enterContext( $this->{name} . 'Enabled' ); # spent 154µs making 36 calls to Foswiki::enterContext, avg 4µs/call |
286 | } | ||||
287 | |||||
288 | # Invoke a handler | ||||
289 | # spent 38.5ms (1.52+36.9) within Foswiki::Plugin::invoke which was called 238 times, avg 162µs/call:
# 238 times (1.52ms+36.9ms) by Foswiki::Plugins::dispatch at line 341 of /var/www/foswiki11/lib/Foswiki/Plugins.pm, avg 162µs/call | ||||
290 | 238 | 124µs | my $this = shift; # remove from parameter vector | ||
291 | 238 | 53µs | my $handlerName = shift; | ||
292 | 238 | 249µs | my $handler = $this->{module} . '::' . $handlerName; | ||
293 | 2 | 34µs | 2 | 30µs | # spent 19µs (8+11) within Foswiki::Plugin::BEGIN@293 which was called:
# once (8µs+11µs) by Foswiki::Plugins::BEGIN@21 at line 293 # spent 19µs making 1 call to Foswiki::Plugin::BEGIN@293
# spent 11µs making 1 call to strict::unimport |
294 | 238 | 1.75ms | 238 | 37.3ms | return &$handler(@_); # spent 12.8ms making 5 calls to Foswiki::Plugins::TablePlugin::preRenderingHandler, avg 2.56ms/call
# spent 9.63ms making 5 calls to Foswiki::Plugins::FindElsewherePlugin::startRenderingHandler, avg 1.93ms/call
# spent 4.05ms making 5 calls to Foswiki::Plugins::SmiliesPlugin::preRenderingHandler, avg 810µs/call
# spent 2.78ms making 13 calls to Foswiki::Plugins::CommentPlugin::commonTagsHandler, avg 214µs/call
# spent 2.78ms making 13 calls to Foswiki::Plugins::DirectedGraphPlugin::commonTagsHandler, avg 214µs/call
# spent 1.36ms making 5 calls to Foswiki::Plugins::InterwikiPlugin::preRenderingHandler, avg 271µs/call
# spent 937µs making 13 calls to Foswiki::Plugins::ChecklistPlugin::commonTagsHandler, avg 72µs/call
# spent 433µs making 5 calls to Foswiki::Plugins::ChecklistPlugin::postRenderingHandler, avg 87µs/call
# spent 368µs making 13 calls to Foswiki::Plugins::PlantUMLPlugin::commonTagsHandler, avg 28µs/call
# spent 256µs making 13 calls to Foswiki::Plugins::CompareRevisionsAddonPlugin::commonTagsHandler, avg 20µs/call
# spent 214µs making 13 calls to Foswiki::Plugins::ActionTrackerPlugin::commonTagsHandler, avg 16µs/call
# spent 197µs making 13 calls to Foswiki::Plugins::RevCommentPlugin::commonTagsHandler, avg 15µs/call
# spent 170µs making 13 calls to Foswiki::Plugins::ChartPlugin::commonTagsHandler, avg 13µs/call
# spent 162µs making 7 calls to Foswiki::Plugins::WysiwygPlugin::beforeCommonTagsHandler, avg 23µs/call
# spent 162µs making 13 calls to Foswiki::Plugins::EditTablePlugin::commonTagsHandler, avg 12µs/call
# spent 142µs making 1 call to Foswiki::Plugins::JQueryPlugin::finishPlugin
# spent 131µs making 13 calls to Foswiki::Plugins::SpreadSheetPlugin::commonTagsHandler, avg 10µs/call
# spent 112µs making 13 calls to Foswiki::Plugins::SmiliesPlugin::commonTagsHandler, avg 9µs/call
# spent 108µs making 13 calls to Foswiki::Plugins::SlideShowPlugin::commonTagsHandler, avg 8µs/call
# spent 84µs making 7 calls to Foswiki::Plugins::EditTablePlugin::beforeCommonTagsHandler, avg 12µs/call
# spent 82µs making 7 calls to Foswiki::Plugins::TablePlugin::afterCommonTagsHandler, avg 12µs/call
# spent 67µs making 7 calls to Foswiki::Plugins::AttachContentPlugin::beforeCommonTagsHandler, avg 10µs/call
# spent 60µs making 7 calls to Foswiki::Plugins::PreferencesPlugin::beforeCommonTagsHandler, avg 9µs/call
# spent 60µs making 1 call to Foswiki::Plugins::WysiwygPlugin::modifyHeaderHandler
# spent 57µs making 5 calls to Foswiki::Plugins::PreferencesPlugin::postRenderingHandler, avg 11µs/call
# spent 53µs making 5 calls to Foswiki::Plugins::EditTablePlugin::postRenderingHandler, avg 11µs/call
# spent 51µs making 5 calls to Foswiki::Plugins::RenderListPlugin::preRenderingHandler, avg 10µs/call
# spent 27µs making 5 calls to Foswiki::Plugins::WysiwygPlugin::postRenderingHandler, avg 5µs/call |
295 | 2 | 45µs | 2 | 24µs | # spent 15µs (7+8) within Foswiki::Plugin::BEGIN@295 which was called:
# once (7µs+8µs) by Foswiki::Plugins::BEGIN@21 at line 295 # spent 15µs making 1 call to Foswiki::Plugin::BEGIN@295
# spent 8µs making 1 call to strict::import |
296 | } | ||||
297 | |||||
298 | # Get the VERSION number of the specified plugin. | ||||
299 | # SMELL: may die if the plugin doesn't compile | ||||
300 | sub getVersion { | ||||
301 | my $this = shift; | ||||
302 | |||||
303 | 2 | 35µs | 2 | 24µs | # spent 16µs (7+9) within Foswiki::Plugin::BEGIN@303 which was called:
# once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 303 # spent 16µs making 1 call to Foswiki::Plugin::BEGIN@303
# spent 9µs making 1 call to strict::unimport |
304 | return ${ $this->{module} . '::VERSION' } || ''; | ||||
305 | 2 | 41µs | 2 | 24µs | # spent 15µs (7+8) within Foswiki::Plugin::BEGIN@305 which was called:
# once (7µs+8µs) by Foswiki::Plugins::BEGIN@21 at line 305 # spent 15µs making 1 call to Foswiki::Plugin::BEGIN@305
# spent 8µs making 1 call to strict::import |
306 | } | ||||
307 | |||||
308 | # Get the RELEASE of the specified plugin. | ||||
309 | # SMELL: may die if the plugin doesn't compile | ||||
310 | sub getRelease { | ||||
311 | my $this = shift; | ||||
312 | |||||
313 | 2 | 36µs | 2 | 25µs | # spent 16µs (7+9) within Foswiki::Plugin::BEGIN@313 which was called:
# once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 313 # spent 16µs making 1 call to Foswiki::Plugin::BEGIN@313
# spent 9µs making 1 call to strict::unimport |
314 | return ${ $this->{module} . '::RELEASE' } || ''; | ||||
315 | 2 | 318µs | 2 | 24µs | # spent 16µs (7+9) within Foswiki::Plugin::BEGIN@315 which was called:
# once (7µs+9µs) by Foswiki::Plugins::BEGIN@21 at line 315 # spent 16µs making 1 call to Foswiki::Plugin::BEGIN@315
# spent 9µs making 1 call to strict::import |
316 | } | ||||
317 | |||||
318 | # Get the description string for the given plugin | ||||
319 | sub getDescription { | ||||
320 | my $this = shift; | ||||
321 | |||||
322 | unless ( defined $this->{description} ) { | ||||
323 | my $pref = uc( $this->{name} ) . '_SHORTDESCRIPTION'; | ||||
324 | my $prefs = $this->{session}->{prefs}; | ||||
325 | $this->{description} = $prefs->getPreference($pref) || ''; | ||||
326 | } | ||||
327 | if ( $this->{disabled} ) { | ||||
328 | my $reason = ''; | ||||
329 | if ( $this->{reason} ) { | ||||
330 | $reason = | ||||
331 | $this->{session}->inlineAlert( 'alerts', $this->{reason} ); | ||||
332 | } | ||||
333 | return | ||||
334 | ' ' | ||||
335 | . $this->{name} . ': ' | ||||
336 | . $this->{session}->inlineAlert( 'alerts', 'plugin_disabled' ) | ||||
337 | . $reason; | ||||
338 | } | ||||
339 | |||||
340 | my $release = $this->getRelease(); | ||||
341 | my $version = $this->getVersion(); | ||||
342 | $version =~ s/\$Rev: (\d+) \$/$1/g; | ||||
343 | $version = $release . ', ' . $version if $release; | ||||
344 | |||||
345 | my $web = $this->topicWeb(); | ||||
346 | my $result = ' ' . ( $web ? "$web." : '!' ) . $this->{name} . ' '; | ||||
347 | $result .= CGI::span( { class => 'foswikiGrayText foswikiSmall' }, | ||||
348 | '(' . $version . ')' ); | ||||
349 | $result .= ': ' . $this->{description}; | ||||
350 | return $result; | ||||
351 | } | ||||
352 | |||||
353 | =begin TML | ||||
354 | |||||
355 | ---++ ObjectMethod topicWeb() -> $webname | ||||
356 | |||||
357 | Find the web that has the topic for this plugin by searching the | ||||
358 | {Plugins}{WebSearchPath}. Returns undef if $NO_PREFS_IN_TOPIC=1 | ||||
359 | |||||
360 | =cut | ||||
361 | |||||
362 | # spent 784µs (268+516) within Foswiki::Plugin::topicWeb which was called 50 times, avg 16µs/call:
# 36 times (118µs+0s) by Foswiki::Plugin::__ANON__[/var/www/foswiki11/lib/Foswiki/Plugin.pm:241] at line 234, avg 3µs/call
# 7 times (85µs+516µs) by Foswiki::Plugin::load at line 150, avg 86µs/call
# 7 times (66µs+0s) by Foswiki::Plugin::registerSettings at line 216, avg 9µs/call | ||||
363 | 50 | 19µs | my $this = shift; | ||
364 | |||||
365 | 50 | 47µs | unless ( defined( $this->{topicWeb} ) || $this->{no_topic} ) { | ||
366 | |||||
367 | # Find the plugin topic, if required | ||||
368 | 7 | 2µs | my $session = $this->{session}; | ||
369 | |||||
370 | 7 | 20µs | foreach | ||
371 | my $web ( split( /[, ]+/, $Foswiki::cfg{Plugins}{WebSearchPath} ), | ||||
372 | $session->{webName} ) | ||||
373 | { | ||||
374 | 7 | 14µs | 7 | 516µs | if ( $session->topicExists( $web, $this->{name} ) ) { # spent 516µs making 7 calls to Foswiki::topicExists, avg 74µs/call |
375 | 7 | 4µs | $this->{topicWeb} = $web; | ||
376 | 7 | 6µs | last; | ||
377 | } | ||||
378 | } | ||||
379 | } | ||||
380 | |||||
381 | # If there is no web (probably because NO_PREFS_IN_TOPIC is set) | ||||
382 | # then default to the system web name. | ||||
383 | 50 | 6.80ms | return $this->{topicWeb} || $Foswiki::cfg{SystemWebName}; | ||
384 | } | ||||
385 | |||||
386 | 1 | 6µs | 1; | ||
387 | __END__ |