Commit bf17062f authored by Dries's avatar Dries

- Patch #1014096 by chx: don't load schema on every page view.

parent 6cff2ebd
......@@ -2379,13 +2379,15 @@ function menu_link_get_preferred($path = NULL) {
$query->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
$query->fields('ml');
// Weight must be taken from {menu_links}, not {menu_router}.
$query->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array('weight')));
$query->addField('ml', 'weight', 'link_weight');
$query->fields('m');
$query->condition('ml.menu_name', $menu_names, 'IN');
$query->condition('ml.link_path', $path_candidates, 'IN');
// Sort candidates by link path and menu name.
$candidates = array();
foreach ($query->execute() as $candidate) {
$candidate['weight'] = $candidate['link_weight'];
$candidates[$candidate['link_path']][$candidate['menu_name']] = $candidate;
}
......@@ -2505,9 +2507,11 @@ function menu_link_load($mlid) {
$query->leftJoin('menu_router', 'm', 'm.path = ml.router_path');
$query->fields('ml');
// Weight should be taken from {menu_links}, not {menu_router}.
$query->fields('m', array_diff(drupal_schema_fields_sql('menu_router'), array('weight')));
$query->addField('ml', 'weight', 'link_weight');
$query->fields('m');
$query->condition('ml.mlid', $mlid);
if ($item = $query->execute()->fetchAssoc()) {
$item['weight'] = $item['link_weight'];
_menu_link_translate($item);
return $item;
}
......
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