diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-10-16 19:06:25 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-10-16 19:06:25 +0000 |
commit | 60c5878351cc547dbfda260fefcf378491c958ec (patch) | |
tree | 9985db3bf964c09cb8564b54c79f345d773edf21 /includes | |
parent | 4430d46334127c69d5ff97ce2e15475c0fae2654 (diff) | |
download | brdo-60c5878351cc547dbfda260fefcf378491c958ec.tar.gz brdo-60c5878351cc547dbfda260fefcf378491c958ec.tar.bz2 |
- Patch #593746 by #593746 by sun, andypost: prepare Drupal core for dynamic data translation.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 3 | ||||
-rw-r--r-- | includes/database/select.inc | 10 | ||||
-rw-r--r-- | includes/menu.inc | 10 |
3 files changed, 14 insertions, 9 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 83ab8ba0b..ad0186d5d 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -1638,6 +1638,9 @@ function drupal_language_initialize() { foreach ($types as $type) { $GLOBALS[$type] = language_initialize($type); } + // Allow modules to react on language system initialization in multilingual + // environments. + module_invoke_all('language_init', $types); } } diff --git a/includes/database/select.inc b/includes/database/select.inc index cebeef7ad..3eddd3ad7 100644 --- a/includes/database/select.inc +++ b/includes/database/select.inc @@ -1285,6 +1285,11 @@ class SelectQuery extends Query implements SelectQueryInterface { // FIELDS and EXPRESSIONS $fields = array(); + foreach ($this->tables as $alias => $table) { + if (!empty($table['all_fields'])) { + $fields[] = $alias . '.*'; + } + } foreach ($this->fields as $alias => $field) { // Always use the AS keyword for field aliases, as some // databases require it (e.g., PostgreSQL). @@ -1293,11 +1298,6 @@ class SelectQuery extends Query implements SelectQueryInterface { foreach ($this->expressions as $alias => $expression) { $fields[] = $expression['expression'] . ' AS ' . $expression['alias']; } - foreach ($this->tables as $alias => $table) { - if (!empty($table['all_fields'])) { - $fields[] = $alias . '.*'; - } - } $query .= implode(', ', $fields); diff --git a/includes/menu.inc b/includes/menu.inc index 05cdf7771..40992d928 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -934,8 +934,8 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { // Use $mlid as a flag for whether the data being loaded is for the whole tree. $mlid = isset($link['mlid']) ? $link['mlid'] : 0; - // Generate a cache ID (cid) specific for this $menu_name, $item, and depth. - $cid = 'links:' . $menu_name . ':all-cid:' . $mlid . ':' . (int)$max_depth; + // Generate a cache ID (cid) specific for this $menu_name, $link, $language, and depth. + $cid = 'links:' . $menu_name . ':all-cid:' . $mlid . ':' . $GLOBALS['language_interface']->language . ':' . (int)$max_depth; if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. @@ -953,6 +953,7 @@ function menu_tree_all_data($menu_name, $link = NULL, $max_depth = NULL) { // Build the query using a LEFT JOIN since there is no match in // {menu_router} for an external link. $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC)); + $query->addTag('translatable'); $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); $query->fields('ml'); $query->fields('m', array( @@ -1046,7 +1047,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL) { $max_depth = min($max_depth, MENU_MAX_DEPTH); } // Generate a cache ID (cid) specific for this page. - $cid = 'links:' . $menu_name . ':page-cid:' . $item['href'] . ':' . (int)$item['access'] . ':' . (int)$max_depth; + $cid = 'links:' . $menu_name . ':page-cid:' . $item['href'] . ':' . $GLOBALS['language_interface']->language . ':' . (int)$item['access'] . ':' . (int)$max_depth; if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. @@ -1137,6 +1138,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL) { // LEFT JOIN since there is no match in {menu_router} for an external // link. $query = db_select('menu_links', 'ml', array('fetch' => PDO::FETCH_ASSOC)); + $query->addTag('translatable'); $query->leftJoin('menu_router', 'm', 'm.path = ml.router_path'); $query->fields('ml'); $query->fields('m', array( @@ -1193,7 +1195,7 @@ function menu_tree_page_data($menu_name, $max_depth = NULL) { * Helper function - compute the real cache ID for menu tree data. */ function _menu_tree_cid($menu_name, $data) { - return 'links:' . $menu_name . ':tree-data:' . md5(serialize($data)); + return 'links:' . $menu_name . ':tree-data:' . $GLOBALS['language_interface']->language . ':' . md5(serialize($data)); } /** |