summaryrefslogtreecommitdiff
path: root/modules/book
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-08-11 14:06:15 +0000
committerDries Buytaert <dries@buytaert.net>2007-08-11 14:06:15 +0000
commit15c68075d9fe8350a78a9ac5969ecff1be2cee49 (patch)
treed5c48980e30ff7ffd709bf180f9dad6e31d8dbcf /modules/book
parent541c9673b4e2bab76a423d40c5f48cdae2e5c8de (diff)
downloadbrdo-15c68075d9fe8350a78a9ac5969ecff1be2cee49.tar.gz
brdo-15c68075d9fe8350a78a9ac5969ecff1be2cee49.tar.bz2
- Patch #154470 by pwolanin et al: optimize menu queries and indices.
Diffstat (limited to 'modules/book')
-rw-r--r--modules/book/book.module11
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/book/book.module b/modules/book/book.module
index 11b11d258..f67f0e004 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -620,7 +620,7 @@ function book_outline_form_submit($form, &$form_state) {
}
}
else {
- drupal_set_message(t('There was an error adding the post to the book.'));
+ drupal_set_message(t('There was an error adding the post to the book.'), 'error');
}
}
@@ -1451,8 +1451,9 @@ function book_menu_subtree_data($item) {
$data = $cache->data;
}
else {
+ $match = array("menu_name = '%s'");
+ $args = array($item['menu_name']);
$i = 1;
- $match = array();
while ($i <= MENU_MAX_DEPTH && $item["p$i"]) {
$match[] = "p$i = %d";
$args[] = $item["p$i"];
@@ -1460,10 +1461,10 @@ function book_menu_subtree_data($item) {
}
$sql = "
SELECT b.*, m.load_functions, m.to_arg_functions, m.access_callback, m.access_arguments, m.page_callback, m.page_arguments, m.title, m.title_callback, m.title_arguments, m.type, ml.*
- FROM {menu_links} ml LEFT JOIN {menu_router} m ON m.path = ml.router_path
+ FROM {menu_links} ml INNER JOIN {menu_router} m ON m.path = ml.router_path
INNER JOIN {book} b ON ml.mlid = b.mlid
- WHERE ml.hidden >= 0 AND ". implode(' AND ', $match) ."
- ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC";
+ WHERE ". implode(' AND ', $match) ."
+ ORDER BY p1 ASC, p2 ASC, p3 ASC, p4 ASC, p5 ASC, p6 ASC, p7 ASC, p8 ASC, p9 ASC";
$data['tree'] = menu_tree_data(db_query($sql, $args), array(), $item['depth']);
$data['node_links'] = array();