开发者

Drupal modules are calling functions automatically on specific pages, how do I find the code that stops that?

I'm trying to speed up a Drupal 6 site that's running several modules.

开发者_开发百科

I'm looking at the queries on specific pages and see that the site is running queries that don't need to be run on some pages.

Looking into it, it appears some of the modules contain code that basically says "When someone visits page X, run this query so its results can be displayed."

The thing is, this site isn't using that data, so I want to stop the query from running.

However I don't understand enough about Drupal's hooks and menu system to be able to pinpoint the lines of code causing these queries to be run so I can kill them.

Anyone know what I should look for?


Before you start trying to improve performance, you really need to find where performance is being hit.

You need to find where the most time spent is spent / the biggest gain to get. Disabling random queries that isn't needed for some pages, will probably require lots of time spent without gaining any noticeable results.


If you don't use the modules and if the modules that invoke those queries aren't part of drupal core functions, just disable them.

Usually you can alter other modules hooks using hook_alter. Take a look here: hook_alter

You can also try searching for specific permission set to execute those queries and remove the permission for the roles which don't need them.

Otherwise I'm not sure if you can just disable queries that easily without altering the core (which is not recommended!!!).


You aren't going to be able to really do this. Lots of stuff happens on every page because there is no autoloader that only loads the code it needs per page. This is what makes Drupal so strong with its hook system, where any module can invoke any part of Drupal at any time and interact. It is also a flaw, if you want to look at it that way. But its a tradeoff that makes Drupal so flexible.

If you want to speed up the site, try going to Performance, and aggregate CSS/JS, Page Compression. You might also want to add Boost module, to serve up static HTML pages. There are other modules too like memcache, AuthCache, and CacheRouter. This is what you will want to look into, and not hack core.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜