forked from friendica/friendica-addons
this is more correct
This commit is contained in:
parent
497a11a032
commit
d9094aa032
|
@ -174,11 +174,11 @@ function retriever_clean_up_completed_resources($max_items) {
|
|||
// TODO: figure out how to do this with DBA module
|
||||
$r = DBA::p('SELECT retriever_resource.`id` as resource, retriever_item.`id` as item FROM retriever_resource, retriever_item, retriever_rule WHERE retriever_item.`finished` = 0 AND retriever_item.`resource` = retriever_resource.`id` AND retriever_resource.`completed` IS NOT NULL AND retriever_item.`contact-id` = retriever_rule.`contact-id` AND retriever_item.`item-uid` = retriever_rule.`uid` LIMIT %d',
|
||||
intval($max_items));
|
||||
if (!$r) {
|
||||
$r = array();
|
||||
if (!DBA::isResult($r)) {
|
||||
return;
|
||||
}
|
||||
Logger::debug('retriever_clean_up_completed_resources: items waiting even though resource has completed: ' . count($r));
|
||||
foreach ($r as $rr) {
|
||||
Logger::debug('retriever_clean_up_completed_resources: items waiting even though resource has completed: ' . DBA::numRows($r));
|
||||
while ($rr = DBA::fetch($r)) {
|
||||
$retriever_item = DBA::selectFirst('retriever_item', [], ['id' => intval($rr['item'])]);
|
||||
if (!DBA::isResult($retriever_item)) {
|
||||
Logger::warning('retriever_clean_up_completed_resources: no retriever item with id ' . $rr['item']);
|
||||
|
@ -213,8 +213,8 @@ function retriever_tidy() {
|
|||
if (!DBA::isResult($r)) {
|
||||
return;
|
||||
}
|
||||
Logger::info('retriever_tidy: found ' . count($r) . ' retriever_items with no retriever_resource');
|
||||
foreach ($r as $rr) {
|
||||
Logger::info('retriever_tidy: found ' . DBA::numRows($r) . ' retriever_items with no retriever_resource');
|
||||
while ($rr = DBA::fetch($r)) {
|
||||
DBA::e('DELETE FROM retriever_item WHERE id = %d', intval($rr['id']));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue