X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fautohandler;h=ae04d423f7edde9b442747cf95358d782bef1c2d;hb=7a7bcda9d75c951df9c911ce60d5b0551765daf2;hp=a3f7eb0086db5a097cbdd7751c852aa965fb6473;hpb=673b9a458d9138523026963df6fa3b4683e09bae;p=freeside.git diff --git a/httemplate/autohandler b/httemplate/autohandler index a3f7eb008..ae04d423f 100644 --- a/httemplate/autohandler +++ b/httemplate/autohandler @@ -7,15 +7,38 @@ my $profile = ''; if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { - if ( lc($r->content_type) eq 'text/html' ) { + if ( lc($r->content_type) eq 'text/html' + && $FS::CurrentUser::CurrentUser->option('show_db_profile') + ) + { - $profile = '
'. encode_entities(dbh->sprintProfile()).
-               #"\n\n". &sprintAutoProfile(). '
'; - "\n\n". ''; - } + ## barely worth it, just in case someone tries to use profiling on a + ## non-RT install + #eval "use Text::Wrapper;"; + #die $@ if $@; + + my $text = dbh->sprintProfile(); + #$text =~ s/^/ /mg; + + $profile = '
'.  encode_entities( $text ). "\n\n". '
'; + + } + + #well, could do this without sprintProfile, but definiately don't want it on + #unless DBIx::Profile is loaded + if ( $FS::CurrentUser::CurrentUser->option('save_db_profile') ) { + #my $file = %%%FREESIDE_LOG%%%; #substitute here? maybe get from FS.pm? + my $file = '/usr/local/etc/freeside/'; #bah + $file .= "dbix_profile.$$.". time; + dbh->setLogFile($file); + dbh->printProfile(); + } dbh->{'private_profile'} = {}; } s/(<\/BODY>[\s\n]*<\/HTML>[\s\n]*)$/$profile$1/i; +<%cleanup> + dbh->commit(); +