global $CFG;
$all_tags = get_records_list('tag');
-
$tag_correlation_obj = new object();
foreach($all_tags as $tag) {
"WHERE ta.tagid = {$tag->id} AND tb.tagid != {$tag->id} ".
"GROUP BY tb.tagid ".
"HAVING nr > $min_correlation ".
- "ORDER BY nr DESC"; // todo: find out if it's necessary to order.
+ "ORDER BY nr DESC";
$correlated = array();
// than $min_correlation.
if ($tag_correlations = get_records_sql($query)) {
foreach($tag_correlations as $correlation) {
- // commented out - now done in query. kept here in case it breaks on some db
- // if($correlation->nr >= $min_correlation){
+ // commented out - now done in query. kept here in case it breaks on some db
+ // if($correlation->nr >= $min_correlation){
$correlated[] = $correlation->tagid;
- // }
+ // }
}
}
+ if (empty($correlated)) {
+ continue;
+ }
+
$correlated = implode(',', $correlated);
//var_dump($correlated);