Commit b21b5fe3 authored by eskumon's avatar eskumon
Browse files

fix(frontend): Copy screenshots after version update

    Checks if the screenshot column exists (added in the 0.5 release)
and copies local screenshot files to the database

    fixes #1218
parent 08b6c36e
......@@ -15,8 +15,9 @@ use Moose;
use Time::HiRes qw(gettimeofday tv_interval);
use YAML;
use MIME::Base64;
use Socket qw( inet_aton inet_ntoa );
use Image::Magick::Q16;
no warnings "experimental::signatures";
use feature qw(signatures);
......@@ -1261,7 +1262,13 @@ sub _upgrade_tables {
$self->_upgrade_table('domains','is_pool','int NOT NULL default 0');
$self->_upgrade_table('domains','needs_restart','int not null default 0');
if ($self->_upgrade_table('domains','screenshot','BLOB')) {
$self->_upgrade_table('domains_network','allowed','int not null default 1');
$self->_upgrade_table('iptables','id_vm','int DEFAULT NULL');
......@@ -2479,6 +2486,21 @@ sub _cmd_copy_screenshot {
sub _upgrade_screenshots() {
my $self = shift;
my $id = shift or confess "ERROR: missing argument id";
my $sth = $CONNECTOR->dbh->prepare("SELECT file_screenshot FROM domains WHERE id=?");
my ($file_path)= $sth->fetchrow;
my $file= new Image::Magick::Q16;
$self->_data(screenshot => encode_base64($file));
sub _cmd_create{
my $self = shift;
my $request = shift;
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