Skip to content

Commit

Permalink
Merge pull request #21 from ctrliq/devel
Browse files Browse the repository at this point in the history
Package fixes
  • Loading branch information
cigamit authored Apr 18, 2024
2 parents 6435ce2 + 007bafa commit be56f69
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/includes/db_upgrade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

$new_db_version = 10;
$new_db_version = 11;

$db_version = read_setting('db_version', 1);

Expand Down Expand Up @@ -57,7 +57,7 @@
`source` varchar(32) NOT NULL,
`check` tinyint(1) NOT NULL DEFAULT '0')");
db_execute("ALTER TABLE `packages`
ADD PRIMARY KEY `host_name` (`host`, `name`),
ADD PRIMARY KEY (`host`,`name`,`version`,`release`,`epoch`,`arch`),
ADD INDEX `host` (`host`),
ADD INDEX `name` (`name`),
ADD INDEX `arch` (`arch`),
Expand All @@ -78,6 +78,8 @@
ADD INDEX `status` (`status`),
ADD INDEX `source` (`source`);");
}
case 10:
db_execute("ALTER TABLE `packages` DROP PRIMARY KEY, ADD PRIMARY KEY (`host`,`name`,`version`,`release`,`epoch`,`arch`);");
}
} catch (Exception $e) {

Expand Down
7 changes: 5 additions & 2 deletions src/parse.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@
db_execute_prepare('DELETE FROM `packages` WHERE `host` = ?', array($h));
foreach ($fs as $k => $b) {
foreach ($b as $v) {
db_execute_prepare($s, array($h, sql_clean_package($v['name']), sql_clean_package($v['version']), sql_clean_package($v['release']), sql_clean_package($v['epoch']),
sql_clean_package($v['arch']), sql_clean_package($v['source'])));
try {
db_execute_prepare($s, array($h, sql_clean_package($v['name']), sql_clean_package($v['version']), sql_clean_package($v['release']), sql_clean_package($v['epoch']),
sql_clean_package($v['arch']), sql_clean_package($v['source'])));
} catch (Exception $e) {
}
}
}
} elseif ($t == 'ansible.builtin.service_facts') {
Expand Down

0 comments on commit be56f69

Please sign in to comment.