This commit is contained in:
Matthew Exon 2019-09-29 17:04:34 +02:00 committed by Matthew Exon
parent 86ded88814
commit 0f04231bbe

View file

@ -51,8 +51,10 @@ function retriever_install() {
$schema = file_get_contents(dirname(__file__).'/database.sql'); $schema = file_get_contents(dirname(__file__).'/database.sql');
$arr = explode(';', $schema); $arr = explode(';', $schema);
foreach ($arr as $a) { foreach ($arr as $a) {
$r = q($a); if (!DBA::e($a)) {
//@@@ check for errors Logger::warning('Unable to create database table: ' . DBA::errorMessage());
return;
}
} }
Config::set('retriever', 'dbversion', '0.13'); Config::set('retriever', 'dbversion', '0.13');
} }
@ -142,7 +144,8 @@ function retriever_clean_up_completed_resources($max_items, $a) {
} }
Logger::debug('retriever_clean_up_completed_resources: items waiting even though resource has completed: ' . count($r)); Logger::debug('retriever_clean_up_completed_resources: items waiting even though resource has completed: ' . count($r));
foreach ($r as $rr) { foreach ($r as $rr) {
$resource = q("SELECT * FROM retriever_resource WHERE `id` = %d", $rr['resource']); $resource = DBA::selectFirst('retriever_resource', [], ['id' => intval($rr['resource'])]);
Logger::info('@@@ retriever_clean_up_completed_resources did alternate thing resource type ' . $resource['type']);
$retriever_item = retriever_get_retriever_item($rr['item']); $retriever_item = retriever_get_retriever_item($rr['item']);
if (!DBA::isResult($retriever_item)) { if (!DBA::isResult($retriever_item)) {
Logger::warning('retriever_clean_up_completed_resources: no retriever item with id ' . $rr['item']); Logger::warning('retriever_clean_up_completed_resources: no retriever item with id ' . $rr['item']);
@ -159,7 +162,7 @@ function retriever_clean_up_completed_resources($max_items, $a) {
continue; continue;
} }
Logger::info('@@@ retriever_clean_up_completed_resources: about to retriever_apply_completed_resource_to_item'); Logger::info('@@@ retriever_clean_up_completed_resources: about to retriever_apply_completed_resource_to_item');
retriever_apply_completed_resource_to_item($retriever_rule, $item, $resource[0], $a); retriever_apply_completed_resource_to_item($retriever_rule, $item, $resource, $a);
q("UPDATE `retriever_item` SET `finished` = 1 WHERE id = %d", intval($retriever_item['id'])); q("UPDATE `retriever_item` SET `finished` = 1 WHERE id = %d", intval($retriever_item['id']));
retriever_check_item_completed($item); retriever_check_item_completed($item);
} }