make sure cleanup_tags() actually cleans stuff up
This commit is contained in:
parent
868650e463
commit
b5ec13fa89
|
@ -7149,14 +7149,40 @@
|
||||||
$interval_query = "date_updated < DATE_SUB(NOW(), INTERVAL $days DAY)";
|
$interval_query = "date_updated < DATE_SUB(NOW(), INTERVAL $days DAY)";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tags_deleted = 0;
|
||||||
|
|
||||||
|
while ($limit > 0) {
|
||||||
|
$limit_part = 500;
|
||||||
|
|
||||||
$query = "SELECT ttrss_tags.id AS id
|
$query = "SELECT ttrss_tags.id AS id
|
||||||
FROM ttrss_tags, ttrss_user_entries, ttrss_entries
|
FROM ttrss_tags, ttrss_user_entries, ttrss_entries
|
||||||
WHERE post_int_id = int_id AND $interval_query AND
|
WHERE post_int_id = int_id AND $interval_query AND
|
||||||
ref_id = ttrss_entries.id AND tag_cache != '' LIMIT $limit";
|
ref_id = ttrss_entries.id AND tag_cache != '' LIMIT $limit_part";
|
||||||
|
|
||||||
$result = db_query($link, $query);
|
$result = db_query($link, $query);
|
||||||
|
|
||||||
return db_affected_rows($link, $result);
|
$ids = array();
|
||||||
|
|
||||||
|
while ($line = db_fetch_assoc($result)) {
|
||||||
|
array_push($ids, $line['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($ids) > 0) {
|
||||||
|
$ids = join(",", $ids);
|
||||||
|
print ".";
|
||||||
|
|
||||||
|
$tmp_result = db_query($link, "DELETE FROM ttrss_tags WHERE id IN ($ids)");
|
||||||
|
$tags_deleted += db_affected_rows($link, $tmp_result);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$limit -= $limit_part;
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
return $tags_deleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue