X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fautohandler;h=ae04d423f7edde9b442747cf95358d782bef1c2d;hb=089001124dbd8016d5d51f9aaef50fb9f101dae5;hp=2bd3adffd7ea55b60e341b433dd85ef5c5e851c4;hpb=5fc8c5edf574ab024d4646914b6432d458e2ffbd;p=freeside.git diff --git a/httemplate/autohandler b/httemplate/autohandler index 2bd3adffd..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 = '
'. ("\n"x4096). 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(); +