Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
d4b73ea1
Commit
d4b73ea1
authored
Apr 18, 2017
by
Francesc Guasch
Browse files
[#108] Insert 17.04 data to iso_images
parent
e2b96a6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
d4b73ea1
...
...
@@ -102,6 +102,52 @@ sub BUILD {
Ravada::Auth::
init
(
$CONFIG
);
$self
->
_create_tables
();
$self
->
_upgrade_tables
();
$self
->
_update_data
();
}
sub
_update_isos
{
my
$self
=
shift
;
my
$table
=
'
iso_images
';
my
$field
=
'
name
';
my
%data
=
(
zesty
=>
{
name
=>
'
Ubuntu Zesty Zapus
'
,
description
=>
'
Ubuntu 17.04 Zesty Zapus 64 bits
'
,
arch
=>
'
amd64
'
,
xml
=>
'
yakkety64-amd64.xml
'
,
xml_volume
=>
'
yakkety64-volume.xml
'
,
url
=>
'
http://releases.ubuntu.com/17.04/
'
,
file_re
=>
,'
ubuntu-17.04.*desktop-amd64.iso
'
,
md5_url
=>
,'
http://releases.ubuntu.com/17.04/MD5SUMS
'
}
);
my
$sth_search
=
$CONNECTOR
->
dbh
->
prepare
("
SELECT id FROM
$table
WHERE
$field
= ?
");
for
my
$name
(
keys
%data
)
{
my
$row
=
$data
{
$name
};
$sth_search
->
execute
(
$row
->
{
$field
});
my
(
$id
)
=
$sth_search
->
fetchrow
;
next
if
$id
;
warn
("
INFO: updating
$table
:
$row
->{
$field
}
\n
");
my
$sql
=
"
INSERT INTO iso_images
"
.
"
(
"
.
join
("
,
",
sort
keys
%
{
$data
{
$name
}})
.
"
)
"
.
"
VALUES (
"
.
join
("
,
",
map
{
"
?
"
}
keys
%
{
$data
{
$name
}})
.
"
)
"
;
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
(
$sql
);
$sth
->
execute
(
map
{
$data
{
$name
}
->
{
$_
}
}
sort
keys
%
{
$data
{
$name
}});
$sth
->
finish
;
}
}
sub
_update_data
{
my
$self
=
shift
;
$self
->
_update_isos
();
}
sub
_upgrade_table
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment