Hi, in your code you call this to count terms in a vocabulary:

$count = count(taxonomy_get_tree($vocabulary->vid));

This doesn't work on large taxonomies (100K+), you get a PHP memory issue. My page crashes even with 1GB. A cleaner way to do it:

$count = db_result(db_query('SELECT count(tid) FROM {term_data} WHERE vid=%d', $vocabulary->vid));

Works like a charm! Even with 1mio terms.

Patch attached for 6.x-2.x-dev.

CommentFileSizeAuthor
#1 taxonomy-pruner-php-memory-fix-2.patch732 bytesspaghettibolognese
taxonomy-pruner-php-memory-fix.patch912 bytesAnonymous (not verified)

Comments

spaghettibolognese’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Issue summary: View changes
StatusFileSize
new732 bytes

Same patch, but for d7