In hook nodeapi on the operator load it is always checked or a node has taxonomy. Even if that node type doesn't have any vocabularies attached to it.

This patch only loads taxonomy for a node if the node type allows it.

Comments

R.Muilwijk’s picture

StatusFileSize
new3.63 KB

forgot to use db_distinct_field. New patch is up

nielsvm’s picture

Hi,

I just ran the simpletest suite on pre- and post your patch. The Drupal checkout is from 20.40 (GMT+1) today.

pre:
44 passes, 22 fails and 3 exceptions.

niels@gazprom:~/cvs/drupal$ patch -p0 < taxonomy_nodeapi_load_0.patch
patching file modules/system/system.install
patching file modules/taxonomy/taxonomy.install
patching file modules/taxonomy/taxonomy.module

44 passes, 22 fails and 3 exceptions.

It looks pretty valid to me.

---
The exceptions are probably not related to this patch as they were there already:

Unexpected PHP error [Table 'drupal-trunk.simpletest380167permission' doesn't exist query: INSERT INTO simpletest380167permission (rid, perm) VALUES (3, 'access content, create article content, edit own article content, delete own article content')] severity [E_USER_WARNING] in [/home/niels/cvs/drupal/includes/database.mysqli.inc line 130] EXCEPTION

Unexpected PHP error [preg_match() expects parameter 2 to be string, array given] severity [E_WARNING] in [/home/niels/cvs/drupal/includes/bootstrap.inc line 708] EXCEPTION

Unexpected PHP error [preg_match() expects parameter 2 to be string, array given] severity [E_WARNING] in [/home/niels/cvs/drupal/includes/bootstrap.inc line 708] EXCEPTION

moshe weitzman’s picture

Seems reasonable to me. If sites or modules are doing funny stuff like not affiliating their vocabs with node types then they can be responsible for this load.

About variable_set('taxonomy_omitted_node_types', $omitted) - We don't usually make variables out of data that can be determined with a single query. It isn't a bad idea - just pointing it out.

R.Muilwijk’s picture

Well my thoughts were that it can only change when a vocabulaire is saved. There for it would be overkill to do this every page load.

Cache_get would also cause a query unless you'd be using memory cache. So I figured saving in variable would be best.

R.Muilwijk’s picture

Status: Needs review » Needs work

After some talking with webchick we figured the code checking should be placed in the function taxonomy_node_get_terms and not in nodeapi. Also the doxygen for uninstall/enable are missing.

R.Muilwijk’s picture

StatusFileSize
new3.32 KB

This places the logic of the node_get_term omitted types into taxonomy_node_get_terms(). It also adds DoxyGen

R.Muilwijk’s picture

Status: Needs work » Needs review
catch’s picture

Status: Needs review » Needs work

This looks sane to me, it needs a re-roll for the new database layer though.

xano’s picture

Subscribing.

catch’s picture

Status: Needs work » Closed (duplicate)

Field API handles this now.