Commit f42c1f25 authored by Dries's avatar Dries

- Patch #251239 by R.Muilwijk: performance improvement.

parent 21576021
......@@ -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':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment