1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2025-07-15 01:34:18 +02:00

perltidy code

This commit is contained in:
Hubert depesz Lubaczewski
2019-05-14 13:05:34 +02:00
parent 06503d10d9
commit f9e0abffe5
5 changed files with 31 additions and 26 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
log log
explain.production.json explain.production.json
.vagrant .vagrant
*.beforeTidy

View File

@ -19,9 +19,11 @@ sub startup {
# array format # array format
my $use_secret = $config->{ secret } || 'Xwyfe-_d:yGDr+p][Vs7Kk+e3mmP=c_|s7hvExF=b|4r4^gO|'; my $use_secret = $config->{ secret } || 'Xwyfe-_d:yGDr+p][Vs7Kk+e3mmP=c_|s7hvExF=b|4r4^gO|';
if ( $self->can( 'secrets' ) ) { if ( $self->can( 'secrets' ) ) {
# We're on Mojolicious 4.63 or newer # We're on Mojolicious 4.63 or newer
$self->secrets( [ $use_secret ] ); $self->secrets( [ $use_secret ] );
} else { }
else {
# We're on old Mojolicious # We're on old Mojolicious
$self->secret( $use_secret ); $self->secret( $use_secret );
} }

View File

@ -403,15 +403,17 @@ sub info {
next if $module =~ m{^\.?/}; next if $module =~ m{^\.?/};
$module =~ s/\.pm$//; $module =~ s/\.pm$//;
$module =~ s#/#::#g; $module =~ s#/#::#g;
push @versions, { push @versions,
{
'module' => $module, 'module' => $module,
'version' => $module->VERSION, 'version' => $module->VERSION,
}; };
} }
$self->stash( 'modules' => \@versions ); $self->stash( 'modules' => \@versions );
$self->stash( 'perl' => { $self->stash(
'perl' => {
'version' => $PERL_VERSION, 'version' => $PERL_VERSION,
'binary' => $Config{'perlpath'} . $Config{'_exe'}, 'binary' => $Config{ 'perlpath' } . $Config{ '_exe' },
} }
); );
@ -419,10 +421,11 @@ sub info {
sub status { sub status {
my $self = shift; my $self = shift;
if ($self->database->ping()) { if ( $self->database->ping() ) {
$self->render('text' => 'OK', status => 200); $self->render( 'text' => 'OK', status => 200 );
} else { }
$self->render('text' => 'DB FAILED', status => 500); else {
$self->render( 'text' => 'DB FAILED', status => 500 );
} }
} }

View File

@ -87,7 +87,7 @@ sub user_login {
my $crypted = crypt( $password, $row[ 0 ] ); my $crypted = crypt( $password, $row[ 0 ] );
return if $crypted ne $row[ 0 ]; return if $crypted ne $row[ 0 ];
return { 'admin' => $row[1] }; return { 'admin' => $row[ 1 ] };
} }
sub user_change_password { sub user_change_password {
@ -262,10 +262,9 @@ sub get_plan {
sub get_optimization_path { sub get_optimization_path {
my $self = shift; my $self = shift;
my ($plan_id) = @_; my ( $plan_id ) = @_;
my $rows = $self->dbh->selectall_arrayref( my $rows = $self->dbh->selectall_arrayref( '
'
WITH RECURSIVE path AS ( WITH RECURSIVE path AS (
SELECT id, title, optimization_for, 0 as level FROM plans WHERE id = ? and not is_deleted SELECT id, title, optimization_for, 0 as level FROM plans WHERE id = ? and not is_deleted
union all union all
@ -291,7 +290,7 @@ sub get_optimization_path {
sub get_optimizations_for { sub get_optimizations_for {
my $self = shift; my $self = shift;
my ($plan_id) = @_; my ( $plan_id ) = @_;
my $rows = $self->dbh->selectall_arrayref( my $rows = $self->dbh->selectall_arrayref(
'select id, title from plans where optimization_for = ? and not is_deleted', 'select id, title from plans where optimization_for = ? and not is_deleted',
{ Slice => {} }, { Slice => {} },

View File

@ -21,17 +21,17 @@ sub register {
eval { eval {
my $email = Email::Simple->create( my $email = Email::Simple->create(
header => [ header => [
To => $self->config->{'to'}, To => $self->config->{ 'to' },
From => $self->config->{'from'}, From => $self->config->{ 'from' },
Subject => $self->config->{'subject'}, Subject => $self->config->{ 'subject' },
], ],
body => $mail->{'msg'}, body => $mail->{ 'msg' },
); );
# log debug message # log debug message
$controller->app->log->debug( sprintf "Sending mail:\n%s", $controller->dumper( $email ) ); $controller->app->log->debug( sprintf "Sending mail:\n%s", $controller->dumper( $email ) );
sendmail($email); sendmail( $email );
}; };
if ( $EVAL_ERROR ) { if ( $EVAL_ERROR ) {