diff options
author | ivan <ivan> | 2009-02-17 02:28:48 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-02-17 02:28:48 +0000 |
commit | d7b1a575ccef91f704b1573c431235441d52e47d (patch) | |
tree | 69ae1551039a77ded47c36d162ee2ef83cc85ddd /FS | |
parent | 74190e6834c47c73b7f073fb1de444e572180333 (diff) |
per-user preference for turning on profiling display when DBIx::Profile is loaded, RT#4830
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Mason.pm | 84 |
1 files changed, 56 insertions, 28 deletions
diff --git a/FS/FS/Mason.pm b/FS/FS/Mason.pm index e0f58b814..ee777a485 100644 --- a/FS/FS/Mason.pm +++ b/FS/FS/Mason.pm @@ -233,20 +233,35 @@ Initializes the Mason environment, loads all Freeside and RT libraries, etc. use vars qw($m); # false laziness w/below - if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect - - my $page = - qq!<HTML><BODY>Redirect to <A HREF="$location">$location</A>!. - '<BR><BR><PRE>'. - ( UNIVERSAL::can(dbh, 'sprintProfile') - ? encode_entities(dbh->sprintProfile()) - : 'DBIx::Profile missing sprintProfile method;'. - 'unpatched or too old?' ). - #"\n\n". &sprintAutoProfile(). '</PRE>'. - "\n\n". '</PRE>'. - '</BODY></HTML>'; - dbh->{'private_profile'} = {}; - return $page; + if ( defined(@DBIx::Profile::ISA) ) { + + if ( $FS::CurrentUser::CurrentUser->option('show_db_profile') ) { + + #profiling redirect + + my $page = + qq!<HTML><BODY>Redirect to <A HREF="$location">$location</A>!. + '<BR><BR><PRE>'. + ( UNIVERSAL::can(dbh, 'sprintProfile') + ? encode_entities(dbh->sprintProfile()) + : 'DBIx::Profile missing sprintProfile method;'. + 'unpatched or too old?' ). + #"\n\n". &sprintAutoProfile(). '</PRE>'. + "\n\n". '</PRE>'. + '</BODY></HTML>'; + + + dbh->{'private_profile'} = {}; + return $page; + + } else { + + #clear db profile, but normal redirect + dbh->{'private_profile'} = {}; + $m->redirect($location); + ''; + + } } else { #normal redirect @@ -272,20 +287,33 @@ Initializes the Mason environment, loads all Freeside and RT libraries, etc. use vars qw($m); $m->clear_buffer; #false laziness w/above - if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect - - $m->print( - qq!<HTML><BODY>Redirect to <A HREF="$location">$location</A>!. - '<BR><BR><PRE>'. - ( UNIVERSAL::can(dbh, 'sprintProfile') - ? encode_entities(dbh->sprintProfile()) - : 'DBIx::Profile missing sprintProfile method;'. - 'unpatched or too old?' ). - #"\n\n". &sprintAutoProfile(). '</PRE>'. - "\n\n". '</PRE>'. - '</BODY></HTML>' - ); - dbh->{'private_profile'} = {}; + if ( defined(@DBIx::Profile::ISA) ) { + + if ( $FS::CurrentUser::CurrentUser->option('show_db_profile') ) { + + #profiling redirect + + $m->print( + qq!<HTML><BODY>Redirect to <A HREF="$location">$location</A>!. + '<BR><BR><PRE>'. + ( UNIVERSAL::can(dbh, 'sprintProfile') + ? encode_entities(dbh->sprintProfile()) + : 'DBIx::Profile missing sprintProfile method;'. + 'unpatched or too old?' ). + #"\n\n". &sprintAutoProfile(). '</PRE>'. + "\n\n". '</PRE>'. + '</BODY></HTML>' + ); + + dbh->{'private_profile'} = {}; + + } else { + + #clear db profile, but normal redirect + dbh->{'private_profile'} = {}; + $m->redirect($location); + + } } else { #normal redirect |