Commit c706d11a authored by Gerhard Killesreiter's avatar Gerhard Killesreiter
Browse files

#16542, add db rewriting for menus, patch by chx

fixes 57406 too
parent 9814b832
...@@ -223,7 +223,7 @@ function db_queryd($query) { ...@@ -223,7 +223,7 @@ function db_queryd($query) {
* @param $query * @param $query
* Query to be rewritten. * Query to be rewritten.
* @param $primary_table * @param $primary_table
* Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, term_data, vocabulary. * Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, menu, term_data, vocabulary.
* @param $primary_field * @param $primary_field
* Name of the primary field. * Name of the primary field.
* @param $args * @param $args
...@@ -266,7 +266,7 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni ...@@ -266,7 +266,7 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni
* @param $query * @param $query
* Query to be rewritten. * Query to be rewritten.
* @param $primary_table * @param $primary_table
* Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, term_data, vocabulary. * Name or alias of the table which has the primary key field for this query. Possible values are: comments, forum, node, menu, term_data, vocabulary.
* @param $primary_field * @param $primary_field
* Name of the primary field. * Name of the primary field.
* @param $args * @param $args
......
...@@ -1052,7 +1052,7 @@ function _menu_build() { ...@@ -1052,7 +1052,7 @@ function _menu_build() {
// Now fetch items from the DB, reassigning menu IDs as needed. // Now fetch items from the DB, reassigning menu IDs as needed.
if (module_exist('menu')) { if (module_exist('menu')) {
$result = db_query('SELECT * FROM {menu} ORDER BY mid ASC'); $result = db_query(db_rewrite_sql('SELECT m.mid, m.* FROM {menu} m ORDER BY m.mid ASC', 'm', 'mid'));
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
// Handle URL aliases if entered in menu administration. // Handle URL aliases if entered in menu administration.
if (!isset($_menu['path index'][$item->path])) { if (!isset($_menu['path index'][$item->path])) {
......
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