Commit b86354c5 authored by Dries's avatar Dries

- Patch #225562 by Jody Lynn: change DB table names from eg. term_data to taxonomy_term_data.

parent b986cc55
......@@ -2539,7 +2539,7 @@ function db_affected_rows() {
* @param $primary_table
* Name or alias of the table which has the primary key field for this query.
* Typical table names would be: {block}, {comment}, {forum}, {node},
* {menu}, {term_data} or {vocabulary}. However, in most cases the usual
* {menu}, {taxonomy_term_data} or {taxonomy_vocabulary}. However, in most cases the usual
* table alias (b, c, f, n, m, t or v) is used instead of the table name.
* @param $primary_field
* Name of the primary field.
......@@ -2586,7 +2586,7 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni
* @param $primary_table
* Name or alias of the table which has the primary key field for this query.
* Typical table names would be: {block}, {comment}, {forum}, {node},
* {menu}, {term_data} or {vocabulary}. However, it is more common to use the
* {menu}, {taxonomy_term_data} or {taxonomy_vocabulary}. However, it is more common to use the
* the usual table aliases: b, c, f, n, m, t or v.
* @param $primary_field
* Name of the primary field.
......
......@@ -584,7 +584,7 @@ function blogapi_mt_validate_terms($node) {
$term_list = array_unique($node->taxonomy);
$params = $term_list;
$params[] = $node->type;
$result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {term_data} t INNER JOIN {vocabulary_node_type} n ON t.vid = n.vid WHERE t.tid IN (". db_placeholders($term_list) .") AND n.type = '%s'", 't', 'tid'), $params);
$result = db_query(db_rewrite_sql("SELECT t.tid, t.vid FROM {taxonomy_term_data} t INNER JOIN {taxonomy_vocabulary_node_type} n ON t.vid = n.vid WHERE t.tid IN (". db_placeholders($term_list) .") AND n.type = '%s'", 't', 'tid'), $params);
$found_terms = array();
$found_count = 0;
while ($term = db_fetch_object($result)) {
......@@ -597,7 +597,7 @@ function blogapi_mt_validate_terms($node) {
}
}
// Look up all the vocabularies for this node type.
$result2 = db_query(db_rewrite_sql("SELECT v.vid, v.name, v.required, v.multiple FROM {vocabulary} v INNER JOIN {vocabulary_node_type} n ON v.vid = n.vid WHERE n.type = '%s'", 'v', 'vid'), $node->type);
$result2 = db_query(db_rewrite_sql("SELECT v.vid, v.name, v.required, v.multiple FROM {taxonomy_vocabulary} v INNER JOIN {taxonomy_vocabulary_node_type} n ON v.vid = n.vid WHERE n.type = '%s'", 'v', 'vid'), $node->type);
// Check each vocabulary associated with this node type.
while ($vocabulary = db_fetch_object($result2)) {
// Required vocabularies must have at least one term.
......
......@@ -86,7 +86,7 @@ function forum_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {term_data}.tid of the forum term assigned to the node.',
'description' => 'The {taxonomy_term_data}.tid of the forum term assigned to the node.',
),
),
'indexes' => array(
......
......@@ -74,7 +74,7 @@ function forum_theme() {
* An associative array containing the term data or FALSE if the term cannot be loaded, or is not part of the forum vocabulary.
*/
function forum_term_load($tid) {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary', ''));
$result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {taxonomy_term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary', ''));
return db_fetch_array($result);
}
......@@ -250,7 +250,7 @@ function forum_nodeapi_validate($node, $form) {
$vocabulary = $vid;
$containers = variable_get('forum_containers', array());
foreach ($node->taxonomy as $term) {
if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
if (db_result(db_query('SELECT COUNT(*) FROM {taxonomy_term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) {
if (in_array($term, $containers)) {
$term = taxonomy_term_load($term);
form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => $term->name)));
......@@ -283,7 +283,7 @@ function forum_nodeapi_presave($node) {
$node->tid = $term_id;
}
}
$old_tid = db_result(db_query_range("SELECT t.tid FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.nid = %d ORDER BY t.vid DESC", $node->nid, 0, 1));
$old_tid = db_result(db_query_range("SELECT t.tid FROM {taxonomy_term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.nid = %d ORDER BY t.vid DESC", $node->nid, 0, 1));
if ($old_tid && isset($node->tid) && ($node->tid != $old_tid) && !empty($node->shadow)) {
// A shadow copy needs to be created. Retain new term and add old term.
$node->taxonomy[] = $old_tid;
......@@ -414,7 +414,7 @@ function forum_taxonomy($op, $type, $term = NULL) {
if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary', '')) {
switch ($type) {
case 'term':
$results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']);
$results = db_query('SELECT tn.nid FROM {taxonomy_term_node} tn WHERE tn.tid = %d', $term['tid']);
while ($node = db_fetch_object($results)) {
// node_delete will also remove any association with non-forum vocabularies.
node_delete($node->nid);
......@@ -503,8 +503,8 @@ function forum_block_view($delta = '') {
case 'active':
$title = t('Active forum topics');
$query = db_select('node', 'n');
$tn_alias = $query->join('term_node', 'tn', 'tn.vid = n.vid');
$td_alias = $query->join('term_data', 'td', 'tn.tid = tn.tid');
$tn_alias = $query->join('taxonomy_term_node', 'tn', 'tn.vid = n.vid');
$td_alias = $query->join('taxonomy_term_data', 'td', 'tn.tid = tn.tid');
$l_alias = $query->join('node_comment_statistics', 'l', 'n.nid = l.nid');
$query->addField('n', 'nid', 'nid');
$query->addField('n', 'title', 'title');
......@@ -521,7 +521,7 @@ function forum_block_view($delta = '') {
case 'new':
$title = t('New forum topics');
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY n.nid DESC");
$sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {taxonomy_term_node} tn ON tn.vid = n.vid INNER JOIN {taxonomy_term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY n.nid DESC");
$result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_new', '5'));
$content = node_title_list($result);
break;
......@@ -588,7 +588,7 @@ function forum_get_forums($tid = 0) {
$counts = array();
$sql = "SELECT r.tid, COUNT(n.nid) AS topic_count, SUM(l.comment_count) AS comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.vid = r.vid WHERE n.status = 1 GROUP BY r.tid";
$sql = "SELECT r.tid, COUNT(n.nid) AS topic_count, SUM(l.comment_count) AS comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid WHERE n.status = 1 GROUP BY r.tid";
$sql = db_rewrite_sql($sql);
$_counts = db_query($sql);
while ($count = db_fetch_object($_counts)) {
......@@ -613,7 +613,7 @@ function forum_get_forums($tid = 0) {
// This query does not use full ANSI syntax since MySQL 3.x does not support
// table1 INNER JOIN table2 INNER JOIN table3 ON table2_criteria ON table3_criteria
// used to join node_comment_statistics to users.
$sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
$sql = "SELECT ncs.last_comment_timestamp, IF (ncs.last_comment_uid != 0, u2.name, ncs.last_comment_name) AS last_comment_name, ncs.last_comment_uid FROM {node} n INNER JOIN {users} u1 ON n.uid = u1.uid INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid INNER JOIN {node_comment_statistics} ncs ON n.nid = ncs.nid INNER JOIN {users} u2 ON ncs.last_comment_uid=u2.uid WHERE n.status = 1 AND tn.tid = %d ORDER BY ncs.last_comment_timestamp DESC";
$sql = db_rewrite_sql($sql);
$topic = db_fetch_object(db_query_range($sql, $forum->tid, 0, 1));
......@@ -636,7 +636,7 @@ function forum_get_forums($tid = 0) {
* than NODE_NEW_LIMIT.
*/
function _forum_topics_unread($term, $uid) {
$sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 AND n.created > %d AND h.nid IS NULL";
$sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 AND n.created > %d AND h.nid IS NULL";
$sql = db_rewrite_sql($sql);
return db_result(db_query($sql, $term, $uid, NODE_NEW_LIMIT));
}
......@@ -659,11 +659,11 @@ function forum_get_topics($tid, $sortby, $forum_per_page) {
}
}
$sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
$sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d");
$sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,');
$sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top.
$sql_count = db_rewrite_sql("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} r ON n.vid = r.vid AND r.tid = %d WHERE n.status = 1");
$sql_count = db_rewrite_sql("SELECT COUNT(n.nid) FROM {node} n INNER JOIN {taxonomy_term_node} r ON n.vid = r.vid AND r.tid = %d WHERE n.status = 1");
$result = pager_query($sql, $forum_per_page, 0, $sql_count, $tid);
$topics = array();
......@@ -954,7 +954,7 @@ function template_preprocess_forum_topic_navigation(&$variables) {
$output = '';
// get previous and next topic
$sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order', 1));
$sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {taxonomy_term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order', 1));
$result = db_query(db_rewrite_sql($sql), isset($variables['node']->tid) ? $variables['node']->tid : 0);
$stop = $variables['prev'] = $variables['next'] = 0;
......
......@@ -149,7 +149,7 @@ class ForumTestCase extends DrupalWebTestCase {
*
* @param string $type Forum type (forum container or forum).
* @param integer $parent Forum parent (default = 0 = a root forum; >0 = a forum container or another forum).
* @return object Term_data created.
* @return object Taxonomy_term_data created.
*/
function createForum($type, $parent = 0) {
// Generate a random name/description.
......@@ -170,12 +170,12 @@ class ForumTestCase extends DrupalWebTestCase {
$this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created'));
// Verify forum.
$term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $name, $description));
$term = db_fetch_array(db_query("SELECT * FROM {taxonomy_term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $name, $description));
$this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
// Verify forum hierarchy.
$tid = $term['tid'];
$parent_tid = db_result(db_query("SELECT t.parent FROM {term_hierarchy} t WHERE t.tid = %d", $tid));
$parent_tid = db_result(db_query("SELECT t.parent FROM {taxonomy_term_hierarchy} t WHERE t.tid = %d", $tid));
$this->assertTrue($parent == $parent_tid, 'The ' . $type . ' is linked to its container');
return $term;
......@@ -322,7 +322,7 @@ class ForumTestCase extends DrupalWebTestCase {
/**
* Verify display of forum page.
*
* @param array $forum Forum array (a row from term_data table).
* @param array $forum Forum array (a row from taxonomy_term_data table).
*/
private function verifyForumView($forum, $parent = NULL) {
$crumb = '›';
......@@ -342,7 +342,7 @@ class ForumTestCase extends DrupalWebTestCase {
/**
* Generate forum topics to test display of active forum block.
*
* @param array $forum Forum array (a row from term_data table).
* @param array $forum Forum array (a row from taxonomy_term_data table).
*/
private function generateForumTopics($forum) {
$this->nids = array();
......
......@@ -184,7 +184,7 @@ function node_build_filter_query() {
case 'term':
$table = "tn$index";
$where[] = "$table.tid = %d";
$join .= "INNER JOIN {term_node} $table ON n.nid = $table.nid ";
$join .= "INNER JOIN {taxonomy_term_node} $table ON n.nid = $table.nid ";
break;
case 'type':
$where[] = "n.type = '%s'";
......
......@@ -1373,7 +1373,7 @@ function node_search($op = 'search', $keys = NULL) {
$arguments1[] = $c;
}
$conditions1 .= ' AND (' . implode(' OR ', $terms) . ')';
$join1 .= ' INNER JOIN {term_node} tn ON n.vid = tn.vid';
$join1 .= ' INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid';
$keys = search_query_insert($keys, 'term');
}
......
......@@ -128,7 +128,7 @@ function hook_search($op = 'search', $keys = null) {
$arguments1[] = $c;
}
$conditions1 .= ' AND (' . implode(' OR ', $categories) . ')';
$join1 .= ' INNER JOIN {term_node} tn ON n.vid = tn.vid';
$join1 .= ' INNER JOIN {taxonomy_term_node} tn ON n.vid = tn.vid';
$keys = search_query_insert($keys, 'category');
}
......
......@@ -18,7 +18,7 @@ function taxonomy_test_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {term_data}.tid of the term.',
'description' => 'The {taxonomy_term_data}.tid of the term.',
),
'name' => array(
'type' => 'varchar',
......
......@@ -41,7 +41,7 @@ function hook_cron() {
* shall be made DISTINCT. For node objects, primary field is always called nid.
* For taxonomy terms, it is tid and for vocabularies it is vid. For comments,
* it is cid. Primary table is the table where the primary object (node, file,
* term_node etc.) is.
* taxonomy_term_node etc.) is.
*
* You shall return an associative array. Possible keys are 'join', 'where' and
* 'distinct'. The value of 'distinct' shall be 1 if you want that the
......@@ -52,7 +52,7 @@ function hook_cron() {
* @param $primary_table
* Name or alias of the table which has the primary key field for this query.
* Typical table names would be: {block}, {comment}, {forum}, {node},
* {menu}, {term_data} or {vocabulary}. However, it is more common for
* {menu}, {taxonomy_term_data} or {taxonomy_vocabulary}. However, it is more common for
* $primary_table to contain the usual table alias: b, c, f, n, m, t or v.
* @param $primary_field
* Name of the primary field.
......
......@@ -271,8 +271,8 @@ function taxonomy_overview_terms(&$form_state, $vocabulary) {
if ($vocabulary->tags) {
// We are not calling taxonomy_get_tree because that might fail with a big
// number of tags in the freetagging vocabulary.
$results = pager_query(db_rewrite_sql('SELECT t.*, h.parent FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $page_increment, 0, NULL, $vocabulary->vid);
$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {term_data} t INNER JOIN {term_hierarchy} h ON t.tid = h.tid WHERE t.vid = :vid'), array(':vid' => $vocabulary->vid));
$results = pager_query(db_rewrite_sql('SELECT t.*, h.parent FROM {taxonomy_term_data} t INNER JOIN {taxonomy_term_hierarchy} h ON t.tid = h.tid WHERE t.vid = %d ORDER BY weight, name', 't', 'tid'), $page_increment, 0, NULL, $vocabulary->vid);
$total_entries = db_query(db_rewrite_sql('SELECT count(*) FROM {taxonomy_term_data} t INNER JOIN {taxonomy_term_hierarchy} h ON t.tid = h.tid WHERE t.vid = :vid'), array(':vid' => $vocabulary->vid));
while ($term = db_fetch_object($results)) {
$key = 'tid:' . $term->tid . ':0';
$current_page[$key] = $term;
......@@ -909,7 +909,7 @@ function taxonomy_vocabulary_confirm_reset_alphabetical(&$form_state, $vid) {
* @see taxonomy_vocabulary_confirm_reset_alphabetical()
*/
function taxonomy_vocabulary_confirm_reset_alphabetical_submit($form, &$form_state) {
db_query('UPDATE {term_data} SET weight = 0 WHERE vid = :vid', array(':vid' => $form_state['values']['vid']));
db_query('UPDATE {taxonomy_term_data} SET weight = 0 WHERE vid = :vid', array(':vid' => $form_state['values']['vid']));
drupal_set_message(t('Reset vocabulary %name to alphabetical order.', array('%name' => $form_state['values']['name'])));
watchdog('taxonomy', 'Reset vocabulary %name to alphabetical order.', array('%name' => $form_state['values']['name']), WATCHDOG_NOTICE);
$form_state['redirect'] = 'admin/content/taxonomy/' . $form_state['values']['vid'];
......
......@@ -78,7 +78,7 @@ function hook_taxonomy_vocabulary_delete($vocabulary) {
* loaded in a single query for all terms where possible.
*
* Since terms are stored and retrieved from cache during a page request, avoid
* altering properties provided by the {term_data} table, since this may
* altering properties provided by the {taxonomy_term_data} table, since this may
* affect the way results are loaded from cache in subsequent calls.
*
* @param $terms
......@@ -104,7 +104,7 @@ function hook_taxonomy_term_insert($term) {
if (!empty($term->synonyms)) {
foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) {
if ($synonym) {
db_insert('term_synonym')
db_insert('taxonomy_term_synonym')
->fields(array(
'tid' => $term->tid,
'name' => rtrim($synonym),
......@@ -128,7 +128,7 @@ function hook_taxonomy_term_update($term) {
if (!empty($term->synonyms)) {
foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) {
if ($synonym) {
db_insert('term_synonym')
db_insert('taxonomy_term_synonym')
->fields(array(
'tid' => $term->tid,
'name' => rtrim($synonym),
......
......@@ -5,7 +5,7 @@
* Implementation of hook_schema().
*/
function taxonomy_schema() {
$schema['term_data'] = array(
$schema['taxonomy_term_data'] = array(
'description' => 'Stores term information.',
'fields' => array(
'tid' => array(
......@@ -19,7 +19,7 @@ function taxonomy_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {vocabulary}.vid of the vocabulary to which the term is assigned.',
'description' => 'The {taxonomy_vocabulary}.vid of the vocabulary to which the term is assigned.',
),
'name' => array(
'type' => 'varchar',
......@@ -49,7 +49,7 @@ function taxonomy_schema() {
),
);
$schema['term_hierarchy'] = array(
$schema['taxonomy_term_hierarchy'] = array(
'description' => 'Stores the hierarchical relationship between terms.',
'fields' => array(
'tid' => array(
......@@ -57,14 +57,14 @@ function taxonomy_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {term_data}.tid of the term.',
'description' => 'Primary Key: The {taxonomy_term_data}.tid of the term.',
),
'parent' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => "Primary Key: The {term_data}.tid of the term's parent. 0 indicates no parent.",
'description' => "Primary Key: The {taxonomy_term_data}.tid of the term's parent. 0 indicates no parent.",
),
),
'indexes' => array(
......@@ -73,7 +73,7 @@ function taxonomy_schema() {
'primary key' => array('tid', 'parent'),
);
$schema['term_node'] = array(
$schema['taxonomy_term_node'] = array(
'description' => 'Stores the relationship of terms to nodes.',
'fields' => array(
'nid' => array(
......@@ -95,7 +95,7 @@ function taxonomy_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: The {term_data}.tid of a term assigned to the node.',
'description' => 'Primary Key: The {taxonomy_term_data}.tid of a term assigned to the node.',
),
),
'indexes' => array(
......@@ -105,7 +105,7 @@ function taxonomy_schema() {
'primary key' => array('tid', 'vid'),
);
$schema['term_relation'] = array(
$schema['taxonomy_term_relation'] = array(
'description' => 'Stores non-hierarchical relationships between terms.',
'fields' => array(
'trid' => array(
......@@ -118,14 +118,14 @@ function taxonomy_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {term_data}.tid of the first term in a relationship.',
'description' => 'The {taxonomy_term_data}.tid of the first term in a relationship.',
),
'tid2' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {term_data}.tid of the second term in a relationship.',
'description' => 'The {taxonomy_term_data}.tid of the second term in a relationship.',
),
),
'unique keys' => array(
......@@ -137,7 +137,7 @@ function taxonomy_schema() {
'primary key' => array('trid'),
);
$schema['term_synonym'] = array(
$schema['taxonomy_term_synonym'] = array(
'description' => 'Stores term synonyms.',
'fields' => array(
'tsid' => array(
......@@ -150,7 +150,7 @@ function taxonomy_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'The {term_data}.tid of the term.',
'description' => 'The {taxonomy_term_data}.tid of the term.',
),
'name' => array(
'type' => 'varchar',
......@@ -167,7 +167,7 @@ function taxonomy_schema() {
'primary key' => array('tsid'),
);
$schema['vocabulary'] = array(
$schema['taxonomy_vocabulary'] = array(
'description' => 'Stores vocabulary information.',
'fields' => array(
'vid' => array(
......@@ -257,7 +257,7 @@ function taxonomy_schema() {
),
);
$schema['vocabulary_node_type'] = array(
$schema['taxonomy_vocabulary_node_type'] = array(
'description' => 'Stores which node types vocabularies may be used with.',
'fields' => array(
'vid' => array(
......@@ -265,7 +265,7 @@ function taxonomy_schema() {
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
'description' => 'Primary Key: the {vocabulary}.vid of the vocabulary.',
'description' => 'Primary Key: the {taxonomy_vocabulary}.vid of the vocabulary.',
),
'type' => array(
'type' => 'varchar',
......@@ -285,10 +285,17 @@ function taxonomy_schema() {
}
/**
* Rename {vocabulary_node_types} table to {vocabulary_node_type}.
* Rename taxonomy tables.
*/
function taxonomy_update_7001() {
$ret = array();
db_rename_table($ret, 'vocabulary_node_types', 'vocabulary_node_type');
db_rename_table($ret, 'term_data', 'taxonomy_term_data');
db_rename_table($ret, 'term_hierarchy', 'taxonomy_term_hierarchy');
db_rename_table($ret, 'term_node', 'taxonomy_term_node');
db_rename_table($ret, 'term_relation', 'taxonomy_term_relation');
db_rename_table($ret, 'term_synonym', 'taxonomy_term_synonym');
db_rename_table($ret, 'vocabulary', 'taxonomy_vocabulary');
db_rename_table($ret, 'vocabulary_node_types', 'taxonomy_vocabulary_node_type');
return $ret;
}
This diff is collapsed.
......@@ -16,7 +16,7 @@ function taxonomy_term_page($terms, $depth = 0, $op = 'page') {
$str_tids = $terms['str_tids'];
if ($terms['tids']) {
$result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (' . db_placeholders($terms['tids']) . ')', 't', 'tid'), $terms['tids']);
$result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {taxonomy_term_data} t WHERE t.tid IN (' . db_placeholders($terms['tids']) . ')', 't', 'tid'), $terms['tids']);
$tids = array(); // we rebuild the $tids-array so it only contains terms the user has access to.
$names = array();
while ($term = db_fetch_object($result)) {
......@@ -131,7 +131,7 @@ function taxonomy_autocomplete($vid, $string = '') {
$last_string = trim(array_pop($array));
$matches = array();
if ($last_string != '') {
$result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {term_data} t WHERE t.vid = :vid AND LOWER(t.name) LIKE LOWER(:last_string)", 't', 'tid'), array(
$result = db_query_range(db_rewrite_sql("SELECT t.tid, t.name FROM {taxonomy_term_data} t WHERE t.vid = :vid AND LOWER(t.name) LIKE LOWER(:last_string)", 't', 'tid'), array(
':vid' => $vid,
':last_string' => '%'. $last_string .'%',
), 0, 10);
......
......@@ -360,7 +360,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
$this->drupalGet('node/' . $node->nid);
$this->assertNoText($term2->name, t('Checking if node exists'));
// Checking database fields.
$result = db_query('SELECT * FROM {term_node} WHERE nid = :nid', array(':nid' => $node->nid))->fetch();
$result = db_query('SELECT * FROM {taxonomy_term_node} WHERE nid = :nid', array(':nid' => $node->nid))->fetch();
$this->assertTrue(empty($result), t('Term/node relationships are no longer in the database table.'));
}
......
......@@ -131,7 +131,7 @@ function default_profile_tasks(&$task, $url) {
$description = st('Use tags to group articles on similar topics into categories.');
$help = st('Enter a comma-separated list of words.');
$vid = db_insert('vocabulary')->fields(array(
$vid = db_insert('taxonomy_vocabulary')->fields(array(
'name' => 'Tags',
'description' => $description,
'help' => $help,
......@@ -143,7 +143,7 @@ function default_profile_tasks(&$task, $url) {
'module' => 'taxonomy',
'weight' => 0,
))->execute();
db_insert('vocabulary_node_type')->fields(array('vid' => $vid, 'type' => 'article'))->execute();
db_insert('taxonomy_vocabulary_node_type')->fields(array('vid' => $vid, 'type' => 'article'))->execute();
// Update the menu router information.
menu_rebuild();
......
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