|
|
|
@ -86,7 +86,7 @@ sub system_command ( $self, $cmd, $settings = {} ){ |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub process_webroot ( $job, $site, $source, $dest ) { |
|
|
|
sub process_webroot ( $job, $blog, $source, $dest ) { |
|
|
|
|
|
|
|
|
|
|
|
if ( -d $source ) { |
|
|
|
if ( -d $source ) { |
|
|
|
|
|
|
|
|
|
|
|
@ -97,8 +97,8 @@ sub process_webroot ( $job, $site, $source, $dest ) { |
|
|
|
|
|
|
|
|
|
|
|
my $files = Mojo::File->new( $source )->list_tree; |
|
|
|
my $files = Mojo::File->new( $source )->list_tree; |
|
|
|
|
|
|
|
|
|
|
|
if ( $files->size > $site->max_static_file_count ) { |
|
|
|
if ( $files->size > $blog->max_static_file_count ) { |
|
|
|
$job->fail( "This site may have up to " . $site->max_static_file_count . " static files, however the webroot contains " . $files->size . " files."); |
|
|
|
$job->fail( "This site may have up to " . $blog->max_static_file_count . " static files, however the webroot contains " . $files->size . " files."); |
|
|
|
$job->stop; |
|
|
|
$job->stop; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -106,9 +106,9 @@ sub process_webroot ( $job, $site, $source, $dest ) { |
|
|
|
|
|
|
|
|
|
|
|
foreach my $file ( $files->each ) { |
|
|
|
foreach my $file ( $files->each ) { |
|
|
|
# Does file exceed size allowed? |
|
|
|
# Does file exceed size allowed? |
|
|
|
if ( $file->stat->size >= ( $site->max_static_file_size * 1024 * 1024 ) ) { |
|
|
|
if ( $file->stat->size >= ( $blog->max_static_file_size * 1024 * 1024 ) ) { |
|
|
|
$job->fail( sprintf("This site may have static files up to %d MiB, however %s exceeds this limit.", |
|
|
|
$job->fail( sprintf("This site may have static files up to %d MiB, however %s exceeds this limit.", |
|
|
|
$site->max_static_file_size, |
|
|
|
$blog->max_static_file_size, |
|
|
|
$file->to_string |
|
|
|
$file->to_string |
|
|
|
)); |
|
|
|
)); |
|
|
|
$job->stop; |
|
|
|
$job->stop; |
|
|
|
@ -117,8 +117,8 @@ sub process_webroot ( $job, $site, $source, $dest ) { |
|
|
|
$total_file_size += $file->stat->size; |
|
|
|
$total_file_size += $file->stat->size; |
|
|
|
|
|
|
|
|
|
|
|
# If the total file size exceeds the max_static_webroot_size, fail the job. |
|
|
|
# If the total file size exceeds the max_static_webroot_size, fail the job. |
|
|
|
if ( $total_file_size >= ( $site->max_static_webroot_size * 1024 * 1024 ) ) { |
|
|
|
if ( $total_file_size >= ( $blog->max_static_webroot_size * 1024 * 1024 ) ) { |
|
|
|
$job->fail( "This site may have up to " . $site->max_static_webroot_size . |
|
|
|
$job->fail( "This site may have up to " . $blog->max_static_webroot_size . |
|
|
|
" MiB in static files, however the webroot exceeds this limit." |
|
|
|
" MiB in static files, however the webroot exceeds this limit." |
|
|
|
); |
|
|
|
); |
|
|
|
$job->stop; |
|
|
|
$job->stop; |
|
|
|
@ -140,10 +140,10 @@ sub append_log ( $self, @lines ){ |
|
|
|
$self->note( logs => \@logs ); |
|
|
|
$self->note( logs => \@logs ); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
sub checkout_repo ( $job, $site_id ) { |
|
|
|
sub checkout_repo ( $job, $blog_id ) { |
|
|
|
my $repo = $job->app->db->site($site_id)->repo; |
|
|
|
my $blog = $job->app->db->blog($blog_id)->repo; |
|
|
|
|
|
|
|
|
|
|
|
die "Error: No repo found for site_id: $site_id" |
|
|
|
die "Error: No repo found for site_id: $blog_id" |
|
|
|
unless $repo; |
|
|
|
unless $repo; |
|
|
|
|
|
|
|
|
|
|
|
my $build_dir = Mojo::File->tempdir( 'build-XXXXXX', CLEANUP => 0 ); |
|
|
|
my $build_dir = Mojo::File->tempdir( 'build-XXXXXX', CLEANUP => 0 ); |
|
|
|
|