diff --git a/sandbox_manager/lib/SandboxManager.pm b/sandbox_manager/lib/SandboxManager.pm index 67534db..ce3b336 100644 --- a/sandbox_manager/lib/SandboxManager.pm +++ b/sandbox_manager/lib/SandboxManager.pm @@ -4,7 +4,7 @@ use Mojo::Base 'Mojolicious'; # This method will run once at server start sub startup { - my $self = shift; + my $self = shift; # Load configuration from hash returned by "my_app.conf" my $config = $self->plugin('Config'); @@ -36,6 +36,7 @@ sub startup { $r->any('/delete/:name')->to('sandboxes#delete'); $r->any('/restart_all/:name')->to('sandboxes#restart_all'); $r->any('/reindex_full/:name')->to('sandboxes#reindex_full'); + $r->any('/rebuild_dbic/:name')->to('sandboxes#rebuild_dbic'); $r->any('/clear_database/:name')->to('sandboxes#clear_database'); } diff --git a/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm b/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm index 78a7306..b721e45 100644 --- a/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm +++ b/sandbox_manager/lib/SandboxManager/Controller/Sandboxes.pm @@ -206,6 +206,21 @@ sub apply_bug_submit { ); } +sub rebuild_dbic { + my $self = shift; + my $name = $self->stash('name'); + + $self->redirect_to('/') unless -f "$config_dir/$name.yml"; + + my $output = qx{ docker exec koha-$name /bin/bash -c "/kohadevbox/bin/dbic" } . "\n"; + + $self->render( + title => "Full DBIC Schema Rebuild", + text => $output, + format => 'txt' + ); +} + sub delete { my $self = shift; my $name = $self->stash('name'); diff --git a/sandbox_manager/templates/sandboxes/list.html.tt2 b/sandbox_manager/templates/sandboxes/list.html.tt2 index c1ae5b1..66bd089 100644 --- a/sandbox_manager/templates/sandboxes/list.html.tt2 +++ b/sandbox_manager/templates/sandboxes/list.html.tt2 @@ -85,6 +85,7 @@ Restart services Full Zebra Reindex
+ Refresh schema Clear database Apply patches