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.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | taxonomy_nodeapi_load.patch | 3.32 KB | R.Muilwijk |
| #1 | taxonomy_nodeapi_load.patch | 3.63 KB | R.Muilwijk |
| taxonomy_nodeapi_load.patch | 3.6 KB | R.Muilwijk |
Comments
Comment #1
R.Muilwijk commentedforgot to use db_distinct_field. New patch is up
Comment #2
nielsvm commentedHi,
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
Comment #3
moshe weitzman commentedSeems 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.
Comment #4
R.Muilwijk commentedWell 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.
Comment #5
R.Muilwijk commentedAfter 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.
Comment #6
R.Muilwijk commentedThis places the logic of the node_get_term omitted types into taxonomy_node_get_terms(). It also adds DoxyGen
Comment #7
R.Muilwijk commentedComment #8
catchThis looks sane to me, it needs a re-roll for the new database layer though.
Comment #9
xanoSubscribing.
Comment #10
catchField API handles this now.