← 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/HomePagePlugin.pm
StatementsExecuted 17 statements in 505µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11113µs27µsFoswiki::Plugins::HomePagePlugin::::BEGIN@10Foswiki::Plugins::HomePagePlugin::BEGIN@10
11113µs17µsFoswiki::Plugins::HomePagePlugin::::initializeUserHandlerFoswiki::Plugins::HomePagePlugin::initializeUserHandler
11111µs15µsFoswiki::Plugins::HomePagePlugin::::BEGIN@11Foswiki::Plugins::HomePagePlugin::BEGIN@11
1115µs5µsFoswiki::Plugins::HomePagePlugin::::initPluginFoswiki::Plugins::HomePagePlugin::initPlugin
1114µs4µsFoswiki::Plugins::HomePagePlugin::::BEGIN@13Foswiki::Plugins::HomePagePlugin::BEGIN@13
1114µs4µsFoswiki::Plugins::HomePagePlugin::::BEGIN@14Foswiki::Plugins::HomePagePlugin::BEGIN@14
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2=pod
3
4---+ package Foswiki::Plugins::HomePagePlugin
5
6=cut
7
8package Foswiki::Plugins::HomePagePlugin;
9
10233µs240µs
# spent 27µs (13+13) within Foswiki::Plugins::HomePagePlugin::BEGIN@10 which was called: # once (13µs+13µs) by Foswiki::Plugin::BEGIN@2.19 at line 10
use strict;
# spent 27µs making 1 call to Foswiki::Plugins::HomePagePlugin::BEGIN@10 # spent 13µs making 1 call to strict::import
11228µs219µs
# spent 15µs (11+4) within Foswiki::Plugins::HomePagePlugin::BEGIN@11 which was called: # once (11µs+4µs) by Foswiki::Plugin::BEGIN@2.19 at line 11
use warnings;
# spent 15µs making 1 call to Foswiki::Plugins::HomePagePlugin::BEGIN@11 # spent 4µs making 1 call to warnings::import
12
13219µs14µs
# spent 4µs within Foswiki::Plugins::HomePagePlugin::BEGIN@13 which was called: # once (4µs+0s) by Foswiki::Plugin::BEGIN@2.19 at line 13
use Foswiki::Func ();
# spent 4µs making 1 call to Foswiki::Plugins::HomePagePlugin::BEGIN@13
142408µs14µs
# spent 4µs within Foswiki::Plugins::HomePagePlugin::BEGIN@14 which was called: # once (4µs+0s) by Foswiki::Plugin::BEGIN@2.19 at line 14
use Foswiki::Plugins ();
# spent 4µs making 1 call to Foswiki::Plugins::HomePagePlugin::BEGIN@14
15
161600nsour $VERSION = '1.23';
171200nsour $RELEASE = '1.23';
181200nsour $SHORTDESCRIPTION = 'Allow User specified home pages - on login';
191100nsour $NO_PREFS_IN_TOPIC = 1;
20
21
# spent 5µs within Foswiki::Plugins::HomePagePlugin::initPlugin which was called: # once (5µs+0s) 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 {
22
23 #my ( $topic, $web, $user, $installWeb ) = @_;
2414µs return 1;
25}
26
27
# spent 17µs (13+4) within Foswiki::Plugins::HomePagePlugin::initializeUserHandler which was called: # once (13µs+4µs) by Foswiki::Plugin::load at line 212 of /var/www/foswikidev/core/lib/Foswiki/Plugin.pm
sub initializeUserHandler {
2811µs my ( $loginName, $url, $pathInfo ) = @_;
29
30 return
3112µs12µs unless ( $Foswiki::Plugins::SESSION->inContext('view')
# spent 2µs making 1 call to Foswiki::inContext
32 || $Foswiki::Plugins::SESSION->inContext('login') );
33
34 return
3516µs12µs if ( $Foswiki::Plugins::SESSION->inContext('command_line') );
# spent 2µs making 1 call to Foswiki::inContext
36
37 # Don't override web/topic if specified by url param.
38 return
39 if ( $Foswiki::Plugins::SESSION->{request}->param('defaultweb')
40 || $Foswiki::Plugins::SESSION->{request}->param('topic') );
41
42 my $gotoOnLogin =
43 ( $Foswiki::cfg{HomePagePlugin}{GotoHomePageOnLogin}
44 and $Foswiki::Plugins::SESSION->inContext('login') );
45 if ($gotoOnLogin) {
46 my $test = $Foswiki::Plugins::SESSION->{request}->param('username');
47 $loginName = $test if defined($test);
48
49 # pre-load the origurl with the 'login' url which forces
50 # templatelogin to use the requested web&topic
51 $Foswiki::Plugins::SESSION->{request}->param(
52 -name => 'origurl',
53 -value => $Foswiki::Plugins::SESSION->{request}->url()
54 );
55 }
56
57 # we don't know the user at this point so can only set up the
58 # site wide default
59 my $path_info =
60 Foswiki::urlDecode( $Foswiki::Plugins::SESSION->{request}->path_info() );
61
62 return
63 unless ( ( $path_info eq '' or $path_info eq '/' )
64 or ($gotoOnLogin) );
65
66 my $siteDefault = $Foswiki::cfg{HomePagePlugin}{SiteDefaultTopic};
67
68 #$Foswiki::cfg{HomePagePlugin}{HostnameMapping}
69 my $hostName = lc( Foswiki::Func::getUrlHost() );
70 if (
71 defined( $Foswiki::cfg{HomePagePlugin}{HostnameMapping}->{$hostName} ) )
72 {
73 $siteDefault =
74 $Foswiki::cfg{HomePagePlugin}{HostnameMapping}->{$hostName};
75 }
76
77 my $wikiName = Foswiki::Func::getWikiName($loginName);
78 if ( ( defined $wikiName )
79 and
80 Foswiki::Func::topicExists( $Foswiki::cfg{UsersWebName}, $wikiName ) )
81 {
82 my ( $meta, $text ) =
83 Foswiki::Func::readTopic( $Foswiki::cfg{UsersWebName}, $wikiName );
84
85 # TODO: make fieldname a setting.
86 my $field = $meta->get( 'FIELD', 'HomePage' );
87 my $userHomePage;
88 $userHomePage = $field->{value} if ( defined($field) );
89 $siteDefault = $userHomePage
90 if ( $userHomePage and ( $userHomePage ne '' ) );
91 }
92
93 if ( Foswiki::Func::webExists($siteDefault) ) {
94
95 # if they only set a webname, dwim
96 $siteDefault .= '.' . $Foswiki::cfg{HomeTopicName};
97 }
98
99 return unless defined $siteDefault;
100
101 my ( $web, $topic ) =
102 $Foswiki::Plugins::SESSION->normalizeWebTopicName( '', $siteDefault );
103
104 if ( Foswiki::Func::isValidWebName($web)
105 && Foswiki::Func::isValidTopicName( $topic, 1 ) )
106 {
107 $Foswiki::Plugins::SESSION->{webName} = $web;
108 $Foswiki::Plugins::SESSION->{topicName} = $topic;
109 }
110
111 return;
112}
113
11413µs1;
115__END__