Skip to content

Commit

Permalink
properly disconnect sqlite db before restoring
Browse files Browse the repository at this point in the history
  • Loading branch information
oetiker committed Jun 12, 2023
1 parent 66d2e55 commit 6f00c8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
0.46.2 2023-06-12 15:00:43 +0200 Tobias Oetiker <[email protected]>

- fix restore process to properly reconnect to database

0.46.1 2023-05-23 12:12:33 +0200 Tobias Oetiker <[email protected]>

- resync branches
Expand Down
2 changes: 1 addition & 1 deletion lib/CallBackery.pm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use CallBackery::Plugin::Doc;
use CallBackery::Database;
use CallBackery::User;

our $VERSION = '0.46.1';
our $VERSION = '0.46.2';


=head2 config
Expand Down
2 changes: 2 additions & 0 deletions lib/CallBackery/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,14 @@ sub restoreConfigBlob {
for ($member->fileName){
/^\{DATABASE\}$/ && do {
$self->log->warn("Restoring Database!");
$self->app->database->mojoSqlDb->disconnect;
unlink glob $cfg->{BACKEND}{cfg_db}.'*';
$member->extractToFileNamed($cfg->{BACKEND}{cfg_db});
last;
};
/^\{DATABASEDUMP\}$/ && do {
$self->log->warn("Restoring Database Dump!");
$self->app->database->mojoSqlDb->disconnect;
unlink glob $cfg->{BACKEND}{cfg_db}.'*';
open my $sqlite, '|-', '/usr/bin/sqlite3',$cfg->{BACKEND}{cfg_db};
my $sql = $member->contents();
Expand Down

0 comments on commit 6f00c8d

Please sign in to comment.