The tree view was very slow on one of my sites. Further investigation revealed that (mis)handling of $nodestoexclude in _taxtreenodes_taxonomy_tree() was the cause. At line 175-178 in taxtreenodes.module,

  $nodestoexclude = variable_get('taxtreenodes_nodetypes_to_exclude', 0);
  if ($nodestoexclude != 0) {
    $nodestoexclude = "'" . implode ("','", $nodestoexclude) . "'";
  }

If there are no nodes to exclude, then $nodestoexclude is set to empty array and it ends up being set to '', i.e, two single quotes. This has the side effect of evaluating $nodestoexclude as non numeric at line 355 and cause to build a sql statement, portion of which is [n.type not in ('')] at line 359.

This not-so-good but still valid sql statement runs fine on some systems without revealing this issue, but runs extrememely slow on others (probably with lesser resource mysql configuration).

One solution that I suggest which I am using is to set $nodestoexclude back to zero if empty array,

  $nodestoexclude = variable_get('taxtreenodes_nodetypes_to_exclude', 0);
  $nodestoexclude = empty($nodestoexclude) ? 0 : $nodestoexclude; // Inserted line for fix
  if ($nodestoexclude != 0) {
    $nodestoexclude = "'" . implode ("','", $nodestoexclude) . "'";
  }

Comments

attiks’s picture

Thanks for the info, I'll try to release a new version this week.

attiks’s picture

Status: Active » Closed (won't fix)

Too old