merge-requests/26/head
parent
4430d46334
commit
60c5878351
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -242,12 +242,13 @@ function install_begin_request(&$install_state) {
|
|||
require_once DRUPAL_ROOT . '/includes/file.inc';
|
||||
require_once DRUPAL_ROOT . '/includes/path.inc';
|
||||
|
||||
// Set up $language, so t() caller functions will still work.
|
||||
drupal_language_initialize();
|
||||
|
||||
// Load module basics (needed for hook invokes).
|
||||
include_once DRUPAL_ROOT . '/includes/module.inc';
|
||||
include_once DRUPAL_ROOT . '/includes/session.inc';
|
||||
|
||||
// Set up $language, so t() caller functions will still work.
|
||||
drupal_language_initialize();
|
||||
|
||||
include_once DRUPAL_ROOT . '/includes/entity.inc';
|
||||
$module_list['system']['filename'] = 'modules/system/system.module';
|
||||
$module_list['filter']['filename'] = 'modules/filter/filter.module';
|
||||
|
|
|
@ -85,6 +85,7 @@ function block_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Custom title for the block. (Empty string will use block default title, <none> will remove the title, text will cause block to use specified title.)',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'cache' => array(
|
||||
'type' => 'int',
|
||||
|
@ -173,6 +174,7 @@ function block_schema() {
|
|||
'not null' => FALSE,
|
||||
'size' => 'big',
|
||||
'description' => 'Block contents.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'info' => array(
|
||||
'type' => 'varchar',
|
||||
|
|
|
@ -601,6 +601,7 @@ function _block_load_blocks() {
|
|||
->orderBy('b.weight')
|
||||
->orderBy('b.module')
|
||||
->addTag('block_load')
|
||||
->addTag('translatable')
|
||||
->execute();
|
||||
|
||||
$block_info = $result->fetchAllAssoc('bid');
|
||||
|
|
|
@ -25,6 +25,7 @@ function contact_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Category name.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'recipients' => array(
|
||||
'type' => 'text',
|
||||
|
|
|
@ -24,7 +24,13 @@ function contact_site_form($form, &$form_state) {
|
|||
}
|
||||
|
||||
// Get an array of the categories and the current default category.
|
||||
$categories = db_query("SELECT cid, category FROM {contact} ORDER BY weight, category")->fetchAllKeyed();
|
||||
$categories = db_select('contact', 'c')
|
||||
->addTag('translatable')
|
||||
->fields('c', array('cid', 'category'))
|
||||
->orderBy('weight')
|
||||
->orderBy('category')
|
||||
->execute()
|
||||
->fetchAllKeyed();
|
||||
$default_category = db_query("SELECT cid FROM {contact} WHERE selected = 1")->fetchField();
|
||||
|
||||
// If there are no categories, do not display the form.
|
||||
|
|
|
@ -76,6 +76,7 @@ function filter_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Name of the text format (Filtered HTML).',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'cache' => array(
|
||||
'type' => 'int',
|
||||
|
|
|
@ -335,7 +335,12 @@ function filter_formats($account = NULL) {
|
|||
|
||||
// Statically cache all existing formats upfront.
|
||||
if (!isset($formats['all'])) {
|
||||
$formats['all'] = db_query('SELECT * FROM {filter_format} ORDER BY weight')->fetchAllAssoc('format');
|
||||
$formats['all'] = db_select('filter_format', 'ff')
|
||||
->addTag('translatable')
|
||||
->fields('ff')
|
||||
->orderBy('weight')
|
||||
->execute()
|
||||
->fetchAllAssoc('format');
|
||||
}
|
||||
|
||||
// Build a list of user-specific formats.
|
||||
|
|
|
@ -26,11 +26,13 @@ function menu_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Menu title; displayed at top of block.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'description' => array(
|
||||
'type' => 'text',
|
||||
'not null' => FALSE,
|
||||
'description' => 'Menu description.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
),
|
||||
'primary key' => array('menu_name'),
|
||||
|
|
|
@ -674,6 +674,7 @@ function menu_node_form_submit($form, &$form_state) {
|
|||
function menu_get_menus($all = TRUE) {
|
||||
$system_menus = array_keys(menu_list_system_menus());
|
||||
$query = db_select('menu_custom');
|
||||
$query->addTag('translatable');
|
||||
$query->addField('menu_custom', 'menu_name', 'menu_name');
|
||||
$query->addField('menu_custom', 'title', 'title');
|
||||
if (!$all) {
|
||||
|
|
|
@ -269,6 +269,7 @@ function node_schema() {
|
|||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'base' => array(
|
||||
'description' => 'The base string used to construct callbacks corresponding to this node type.',
|
||||
|
@ -281,12 +282,14 @@ function node_schema() {
|
|||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'size' => 'medium',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'help' => array(
|
||||
'description' => 'Help information shown to the user when creating a {node} of this type.',
|
||||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'size' => 'medium',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'has_title' => array(
|
||||
'description' => 'Boolean indicating whether this type uses the {node}.title field.',
|
||||
|
@ -301,6 +304,7 @@ function node_schema() {
|
|||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'has_body' => array(
|
||||
'description' => 'Boolean indicating whether this type has the body field attached.',
|
||||
|
@ -315,6 +319,7 @@ function node_schema() {
|
|||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'custom' => array(
|
||||
'description' => 'A boolean indicating whether this type is defined by a module (FALSE) or by a user via Add content type (TRUE).',
|
||||
|
|
|
@ -674,9 +674,10 @@ function _node_types_build() {
|
|||
$_node_types->names[$type] = $info['name'];
|
||||
}
|
||||
$type_result = db_select('node_type', 'nt')
|
||||
->addTag('translatable')
|
||||
->addTag('node_type_access')
|
||||
->fields('nt')
|
||||
->orderBy('nt.type', 'ASC')
|
||||
->addTag('node_type_access')
|
||||
->execute();
|
||||
foreach ($type_result as $type_object) {
|
||||
// Check for node types from disabled modules and mark their types for removal.
|
||||
|
|
|
@ -62,6 +62,7 @@ function poll_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'The text for this choice.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'chvotes' => array(
|
||||
'type' => 'int',
|
||||
|
|
|
@ -436,7 +436,12 @@ function poll_load($nodes) {
|
|||
$poll = db_query("SELECT runtime, active FROM {poll} WHERE nid = :nid", array(':nid' => $node->nid))->fetchObject();
|
||||
|
||||
// Load the appropriate choices into the $poll object.
|
||||
$poll->choice = db_query("SELECT chid, chtext, chvotes, weight FROM {poll_choice} WHERE nid = :nid ORDER BY weight", array(':nid' => $node->nid))->fetchAllAssoc('chid', PDO::FETCH_ASSOC);
|
||||
$poll->choice = db_select('poll_choice', 'c')
|
||||
->addTag('translatable')
|
||||
->fields('c', array('chid', 'chtext', 'chvotes', 'weight'))
|
||||
->condition('c', 'nid', $node->nid)
|
||||
->orderBy('weight')
|
||||
->fetchAllAssoc('chid', PDO::FETCH_ASSOC);
|
||||
|
||||
// Determine whether or not this user is allowed to vote.
|
||||
$poll->allowvotes = FALSE;
|
||||
|
|
|
@ -61,6 +61,7 @@ function poll_votes($node) {
|
|||
$select->join('poll_choice', 'pc', 'pv.chid = pc.chid');
|
||||
$select->join('users', 'u', 'pv.uid = u.uid');
|
||||
$queried_votes = $select
|
||||
->addTag('translatable')
|
||||
->fields('pv', array('chid', 'uid', 'hostname', 'timestamp', 'nid'))
|
||||
->fields('pc', array('chtext'))
|
||||
->fields('u', array('name'))
|
||||
|
|
|
@ -568,6 +568,7 @@ function system_schema() {
|
|||
'type' => 'text',
|
||||
'not null' => TRUE,
|
||||
'size' => 'big',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
),
|
||||
'primary key' => array('name'),
|
||||
|
@ -1162,11 +1163,13 @@ function system_schema() {
|
|||
'length' => 255,
|
||||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'options' => array(
|
||||
'description' => 'A serialized array of options to be passed to the url() or l() function, such as a query string or HTML attributes.',
|
||||
'type' => 'text',
|
||||
'not null' => FALSE,
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'module' => array(
|
||||
'description' => 'The name of the module that generated this link.',
|
||||
|
|
|
@ -41,12 +41,14 @@ function taxonomy_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'The term name.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'description' => array(
|
||||
'type' => 'text',
|
||||
'not null' => FALSE,
|
||||
'size' => 'big',
|
||||
'description' => 'A description of the term.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'weight' => array(
|
||||
'type' => 'int',
|
||||
|
@ -108,6 +110,7 @@ function taxonomy_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Name of the vocabulary.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'machine_name' => array(
|
||||
'type' => 'varchar',
|
||||
|
@ -121,6 +124,7 @@ function taxonomy_schema() {
|
|||
'not null' => FALSE,
|
||||
'size' => 'big',
|
||||
'description' => 'Description of the vocabulary.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'relations' => array(
|
||||
'type' => 'int',
|
||||
|
|
|
@ -591,9 +591,9 @@ function taxonomy_get_parents($tid, $key = 'tid') {
|
|||
if ($tid) {
|
||||
$query = db_select('taxonomy_term_data', 't');
|
||||
$query->join('taxonomy_term_hierarchy', 'h', 'h.parent = t.tid');
|
||||
$query->addTag('term_access');
|
||||
|
||||
$result = $query
|
||||
->addTag('translatable')
|
||||
->addTag('term_access')
|
||||
->fields('t')
|
||||
->condition('h.tid', $tid)
|
||||
->orderBy('weight')
|
||||
|
@ -632,9 +632,9 @@ function taxonomy_get_parents_all($tid) {
|
|||
function taxonomy_get_children($tid, $vid = 0, $key = 'tid') {
|
||||
$query = db_select('taxonomy_term_data', 't');
|
||||
$query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid');
|
||||
$query->addTag('term_access');
|
||||
|
||||
$query
|
||||
->addTag('translatable')
|
||||
->addTag('term_access')
|
||||
->fields('t')
|
||||
->condition('parent', $tid)
|
||||
->orderBy('weight')
|
||||
|
@ -685,9 +685,9 @@ function taxonomy_get_tree($vid, $parent = 0, $max_depth = NULL, $depth = -1) {
|
|||
|
||||
$query = db_select('taxonomy_term_data', 't');
|
||||
$query->join('taxonomy_term_hierarchy', 'h', 'h.tid = t.tid');
|
||||
$query->addTag('term_access');
|
||||
|
||||
$result = $query
|
||||
->addTag('translatable')
|
||||
->addTag('term_access')
|
||||
->fields('t')
|
||||
->fields('h', array('parent'))
|
||||
->condition('t.vid', $vid)
|
||||
|
@ -754,6 +754,8 @@ class TaxonomyTermController extends DrupalDefaultEntityController {
|
|||
|
||||
protected function buildQuery() {
|
||||
parent::buildQuery();
|
||||
$this->query->addTag('translatable');
|
||||
$this->query->addTag('term_access');
|
||||
// When name is passed as a condition use LIKE.
|
||||
if (isset($this->conditions['name'])) {
|
||||
$conditions = &$this->query->conditions();
|
||||
|
@ -791,6 +793,7 @@ class TaxonomyTermController extends DrupalDefaultEntityController {
|
|||
class TaxonomyVocabularyController extends DrupalDefaultEntityController {
|
||||
protected function buildQuery() {
|
||||
parent::buildQuery();
|
||||
$this->query->addTag('translatable');
|
||||
$this->query->orderBy('base.weight');
|
||||
$this->query->orderBy('base.name');
|
||||
}
|
||||
|
@ -1149,6 +1152,7 @@ function taxonomy_field_formatter_prepare_view($obj_type, $objects, $field, $ins
|
|||
$query = db_select('taxonomy_term_data', 't');
|
||||
$query->fields('t');
|
||||
$query->condition('t.tid', $tids, 'IN');
|
||||
$query->addTag('translatable');
|
||||
$query->addTag('term_access');
|
||||
$terms = $query->execute()->fetchAllAssoc('tid');
|
||||
|
||||
|
|
|
@ -97,6 +97,7 @@ function taxonomy_autocomplete($field_name, $bundle, $tags_typed = '') {
|
|||
}
|
||||
|
||||
$query = db_select('taxonomy_term_data', 't');
|
||||
$query->addTag('translatable');
|
||||
$query->addTag('term_access');
|
||||
|
||||
// Do not select already entered terms.
|
||||
|
|
|
@ -45,6 +45,7 @@ function upload_schema() {
|
|||
'not null' => TRUE,
|
||||
'default' => '',
|
||||
'description' => 'Description of the uploaded file.',
|
||||
'translatable' => TRUE,
|
||||
),
|
||||
'list' => array(
|
||||
'type' => 'int',
|
||||
|
|
Loading…
Reference in New Issue