当前位置: 动力学知识库 > 问答 > 编程问答 >

Drupal - nodes being loaded for no apparent reason

问题描述:

(Sorry this is rather a vague question. My attempts to be clearer [and indeed to be more code-oriented] have failed...) :-/

//

I've installed the Firebug for Drupal module, and I notice that it shows I'm apparently loading the same eight node objects on every page for no apparent reason. These are all of the same content type (the site uses many other content types).

It seems they are actually all the nodes of this one content type, excepting those produced as dummy content by the developer module.

I've flushed the cache multiple times.

Is there a way to work out where these nodes are being loaded from???

网友答案:

Install devel.module, add ddebug_backtrace(); inside the node_load() function. Reload the site. Now you should see 8 browsable backtraces which will tell you which function calls node_load().

网友答案:

At a guess, you probably have a block (from a view or module) which is querying those nodes on every request.

http://heydon.com.au/node/1044 has a short writeup on this behaviour. If so, the fix is to remove that block from the regions which are rendered, or configure it to only be displayed (and therefore rendered) on pages where you want it to be run.

Drupal caching should prevent those queries being run for anonymous users (depending on the caching and block settings, of course).

网友答案:

I've had this happen with 3rd party modules that were repeatedly calling node_load() needlessly. What I would suggest is for you to disable all 3rd party modules, retry you node loads and re-enable them one by one until you catch the misbehaving module.

Good-luck!

分享给朋友:
您可能感兴趣的文章:
随机阅读: