Commit d940e311 authored by Estefany's avatar Estefany Committed by Francesc Guasch
Browse files

Fix/1218 copy local screenshots database (#1219)

Copies local screenshot files to the database

Checks if the screenshot column exists (added in the 0.5 release)

fixes #1218
parent b77b80dd
......@@ -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);
......@@ -1262,7 +1263,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');
......@@ -2518,6 +2525,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