diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/book.module | 14 | ||||
-rw-r--r-- | modules/book/book.module | 14 |
2 files changed, 18 insertions, 10 deletions
diff --git a/modules/book.module b/modules/book.module index 02323e2b1..d3348096e 100644 --- a/modules/book.module +++ b/modules/book.module @@ -90,11 +90,6 @@ function book_menu($may_cache) { 'callback' => 'book_admin_orphan', 'access' => user_access('administer nodes'), 'weight' => 8); - $result = db_query('SELECT n.nid, n.title FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = 0 ORDER BY b.weight, n.title'); - while ($book = db_fetch_object($result)) { - $items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title))); - } - $items[] = array('path' => 'book', 'title' => t('books'), 'callback' => 'book_render', 'access' => user_access('access content'), @@ -116,6 +111,15 @@ function book_menu($may_cache) { 'type' => MENU_LOCAL_TASK, 'weight' => 2); } } + + // We don't want to cache these menu items because they could change whenever + // a book page or outline node is edited. + if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'book') { + $result = db_query('SELECT n.nid, n.title FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = 0 ORDER BY b.weight, n.title'); + while ($book = db_fetch_object($result)) { + $items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title))); + } + } } return $items; diff --git a/modules/book/book.module b/modules/book/book.module index 02323e2b1..d3348096e 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -90,11 +90,6 @@ function book_menu($may_cache) { 'callback' => 'book_admin_orphan', 'access' => user_access('administer nodes'), 'weight' => 8); - $result = db_query('SELECT n.nid, n.title FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = 0 ORDER BY b.weight, n.title'); - while ($book = db_fetch_object($result)) { - $items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title))); - } - $items[] = array('path' => 'book', 'title' => t('books'), 'callback' => 'book_render', 'access' => user_access('access content'), @@ -116,6 +111,15 @@ function book_menu($may_cache) { 'type' => MENU_LOCAL_TASK, 'weight' => 2); } } + + // We don't want to cache these menu items because they could change whenever + // a book page or outline node is edited. + if (arg(0) == 'admin' && arg(1) == 'node' && arg(2) == 'book') { + $result = db_query('SELECT n.nid, n.title FROM {node} n '. node_access_join_sql() .' INNER JOIN {book} b ON n.nid = b.nid WHERE '. node_access_where_sql() .' AND b.parent = 0 ORDER BY b.weight, n.title'); + while ($book = db_fetch_object($result)) { + $items[] = array('path' => 'admin/node/book/'. $book->nid, 'title' => t('"%title" book', array('%title' => $book->title))); + } + } } return $items; |