summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDries Buytaert2008-04-25 17:51:30 (GMT)
committerDries Buytaert2008-04-25 17:51:30 (GMT)
commitf42c1f25343b8df6557c89697dd6a2f12d117589 (patch)
treeccdf26979b1fea54b45d76f0250921cafb375e41
parent21576021bfe440a0a02b0c179440f00e7182d321 (diff)
- Patch #251239 by R.Muilwijk: performance improvement.
-rw-r--r--modules/book/book.module16
1 files changed, 9 insertions, 7 deletions
diff --git a/modules/book/book.module b/modules/book/book.module
index cc58531..6b524fb 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -658,13 +658,15 @@ function book_build_active_trail($book_link) {
function book_nodeapi(&$node, $op, $teaser, $page) {
switch ($op) {
case 'load':
- // Note - we cannot use book_link_load() because it will call node_load()
- $info['book'] = db_fetch_array(db_query('SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid = %d', $node->nid));
- if ($info['book']) {
- $info['book']['href'] = $info['book']['link_path'];
- $info['book']['title'] = $info['book']['link_title'];
- $info['book']['options'] = unserialize($info['book']['options']);
- return $info;
+ if (in_array($node->type, variable_get('book_allowed_types', array('book')))) {
+ // Note - we cannot use book_link_load() because it will call node_load()
+ $info['book'] = db_fetch_array(db_query('SELECT * FROM {book} b INNER JOIN {menu_links} ml ON b.mlid = ml.mlid WHERE b.nid = %d', $node->nid));
+ if ($info['book']) {
+ $info['book']['href'] = $info['book']['link_path'];
+ $info['book']['title'] = $info['book']['link_title'];
+ $info['book']['options'] = unserialize($info['book']['options']);
+ return $info;
+ }
}
break;
case 'view':