Commit 8998be51 authored by Francesc Guasch's avatar Francesc Guasch
Browse files

fix(install): upgrade screenshots from previous releases

parent 5593973c
......@@ -2539,19 +2539,26 @@ sub _cmd_copy_screenshot {
}
}
sub _upgrade_screenshots() {
sub _upgrade_screenshots($self) {
my $self = shift;
my $id = shift or confess "ERROR: missing argument id";
my $sth = $CONNECTOR->dbh->prepare("SELECT file_screenshot FROM domains WHERE id=?");
$sth->execute($id);
my ($file_path)= $sth->fetchrow;
my $sth = $CONNECTOR->dbh->prepare(
"SELECT id, name, file_screenshot FROM domains WHERE file_screenshot like '%' "
);
$sth->execute();
my $file= new Image::Magick::Q16;
$file->Read($file_path);
$self->_data(screenshot => encode_base64($file));
my $sth_update = $CONNECTOR->dbh->prepare(
"UPDATE domains set screenshot = ? WHERE id=?"
);
while ( my ($id, $name, $file_path)= $sth->fetchrow ) {
next if ! -e $file_path;
warn "INFO: converting screenshot from $name";
my $file= new Image::Magick::Q16;
$file->Read($file_path);
eval {
$sth_update->execute(encode_base64($file), $id);
};
warn $@;
}
}
sub _cmd_create{
......
......@@ -10,7 +10,7 @@ use Moose;
no warnings "experimental::signatures";
use feature qw(signatures);
my $DEBUG=1;
my $DEBUG=0;
has clients => (
is => 'ro'
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment