- Patch #335086 by recidive: rename node, filter and comment module tables to singular for consistency. Oh my.
parent
5c72eb294a
commit
cadd9bd54c
|
@ -2316,7 +2316,7 @@ function db_affected_rows() {
|
|||
* Query to be rewritten.
|
||||
* @param $primary_table
|
||||
* Name or alias of the table which has the primary key field for this query.
|
||||
* Typical table names would be: {block}, {comments}, {forum}, {node},
|
||||
* Typical table names would be: {block}, {comment}, {forum}, {node},
|
||||
* {menu}, {term_data} or {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
|
||||
|
@ -2363,7 +2363,7 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni
|
|||
* Query to be rewritten.
|
||||
* @param $primary_table
|
||||
* Name or alias of the table which has the primary key field for this query.
|
||||
* Typical table names would be: {block}, {comments}, {forum}, {node},
|
||||
* Typical table names would be: {block}, {comment}, {forum}, {node},
|
||||
* {menu}, {term_data} or {vocabulary}. However, it is more common to use the
|
||||
* the usual table aliases: b, c, f, n, m, t or v.
|
||||
* @param $primary_field
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
* References to other tables should be enclosed in
|
||||
* curly-brackets. For example, the node table vid field
|
||||
* description might contain "Always holds the largest (most
|
||||
* recent) {node_revisions}.vid value for this nid."
|
||||
* recent) {node_revision}.vid value for this nid."
|
||||
* - 'type': The generic datatype: 'varchar', 'int', 'serial'
|
||||
* 'float', 'numeric', 'text', 'blob' or 'datetime'. Most types
|
||||
* just map to the according database engine specific
|
||||
|
|
|
@ -1786,7 +1786,7 @@ function form_process_radios($element) {
|
|||
* Add input format selector to text elements with the #input_format property.
|
||||
*
|
||||
* The #input_format property should be the ID of an input format, found in
|
||||
* {filter_formats}.format, which gets passed to filter_form().
|
||||
* {filter_format}.format, which gets passed to filter_form().
|
||||
*
|
||||
* If the property #input_format is set, the form element will be expanded into
|
||||
* two separate form elements, one holding the content of the element, and the
|
||||
|
|
|
@ -153,7 +153,7 @@ function block_schema() {
|
|||
'size' => 'small',
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'description' => "Block body's {filter_formats}.format; for example, 1 = Filtered HTML.",
|
||||
'description' => "Block body's {filter_format}.format; for example, 1 = Filtered HTML.",
|
||||
)
|
||||
),
|
||||
'unique keys' => array(
|
||||
|
|
|
@ -379,7 +379,7 @@ function blogapi_blogger_get_recent_posts($appkey, $blogid, $username, $password
|
|||
}
|
||||
|
||||
if ($bodies) {
|
||||
$result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revisions} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
|
||||
$result = db_query_range("SELECT n.nid, n.title, r.body, r.format, n.comment, n.created, u.name FROM {node} n, {node_revision} r, {users} u WHERE n.uid = u.uid AND n.vid = r.vid AND n.type = :type AND n.uid = :uid ORDER BY n.created DESC", array(
|
||||
':type' => $blogid,
|
||||
':uid' => $user->uid
|
||||
), 0, $number_of_posts);
|
||||
|
|
|
@ -68,7 +68,7 @@ function comment_admin_overview($type = 'new', $arg) {
|
|||
array('data' => t('Time'), 'field' => 'timestamp', 'sort' => 'desc'),
|
||||
array('data' => t('Operations')),
|
||||
));
|
||||
$result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($form['header']['#value']), 50, 0, NULL, $status);
|
||||
$result = pager_query('SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid, n.title as node_title FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid INNER JOIN {node} n ON n.nid = c.nid WHERE c.status = %d' . tablesort_sql($form['header']['#value']), 50, 0, NULL, $status);
|
||||
|
||||
// Build a table listing the appropriate comments.
|
||||
$destination = drupal_get_destination();
|
||||
|
@ -203,7 +203,7 @@ function comment_multiple_delete_confirm(&$form_state) {
|
|||
foreach (array_filter($edit['comments']) as $cid => $value) {
|
||||
$comment = comment_load($cid);
|
||||
if (is_object($comment) && is_numeric($comment->cid)) {
|
||||
$subject = db_result(db_query('SELECT subject FROM {comments} WHERE cid = %d', $cid));
|
||||
$subject = db_result(db_query('SELECT subject FROM {comment} WHERE cid = %d', $cid));
|
||||
$form['comments'][$cid] = array('#type' => 'hidden', '#value' => $cid, '#prefix' => '<li>', '#suffix' => check_plain($subject) . '</li>');
|
||||
$comment_counter++;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ function comment_multiple_delete_confirm_submit($form, &$form_state) {
|
|||
* The comment to be deleted.
|
||||
*/
|
||||
function comment_delete($cid = NULL) {
|
||||
$comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
|
||||
$comment = db_fetch_object(db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.cid = %d', $cid));
|
||||
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
|
||||
$output = '';
|
||||
|
||||
|
@ -308,12 +308,12 @@ function _comment_delete_thread($comment) {
|
|||
}
|
||||
|
||||
// Delete the comment.
|
||||
db_query('DELETE FROM {comments} WHERE cid = %d', $comment->cid);
|
||||
db_query('DELETE FROM {comment} WHERE cid = %d', $comment->cid);
|
||||
watchdog('content', 'Comment: deleted %subject.', array('%subject' => $comment->subject));
|
||||
comment_invoke_comment($comment, 'delete');
|
||||
|
||||
// Delete the comment's replies.
|
||||
$result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
|
||||
$result = db_query('SELECT c.*, u.name AS registered_name, u.uid FROM {comment} c INNER JOIN {users} u ON u.uid = c.uid WHERE pid = %d', $comment->cid);
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
|
||||
_comment_delete_thread($comment);
|
||||
|
|
|
@ -108,6 +108,15 @@ function comment_update_7001() {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename {comments} table to {comment}.
|
||||
*/
|
||||
function comment_update_7002() {
|
||||
$ret = array();
|
||||
db_rename_table($ret, 'comments', 'comment');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "defgroup updates-6.x-to-7.x"
|
||||
* The next series of updates should start at 8000.
|
||||
|
@ -117,7 +126,7 @@ function comment_update_7001() {
|
|||
* Implementation of hook_schema().
|
||||
*/
|
||||
function comment_schema() {
|
||||
$schema['comments'] = array(
|
||||
$schema['comment'] = array(
|
||||
'description' => 'Stores comments and associated data.',
|
||||
'fields' => array(
|
||||
'cid' => array(
|
||||
|
@ -129,7 +138,7 @@ function comment_schema() {
|
|||
'type' => 'int',
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'description' => 'The {comments}.cid to which this comment is a reply. If set to 0, this comment is not a reply to an existing comment.',
|
||||
'description' => 'The {comment}.cid to which this comment is a reply. If set to 0, this comment is not a reply to an existing comment.',
|
||||
),
|
||||
'nid' => array(
|
||||
'type' => 'int',
|
||||
|
@ -182,7 +191,7 @@ function comment_schema() {
|
|||
'size' => 'small',
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'description' => 'The {filter_formats}.format of the comment body.',
|
||||
'description' => 'The {filter_format}.format of the comment body.',
|
||||
),
|
||||
'thread' => array(
|
||||
'type' => 'varchar',
|
||||
|
@ -232,19 +241,19 @@ function comment_schema() {
|
|||
'type' => 'int',
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'description' => 'The Unix timestamp of the last comment that was posted within this node, from {comments}.timestamp.',
|
||||
'description' => 'The Unix timestamp of the last comment that was posted within this node, from {comment}.timestamp.',
|
||||
),
|
||||
'last_comment_name' => array(
|
||||
'type' => 'varchar',
|
||||
'length' => 60,
|
||||
'not null' => FALSE,
|
||||
'description' => 'The name of the latest author to post a comment on this node, from {comments}.name.',
|
||||
'description' => 'The name of the latest author to post a comment on this node, from {comment}.name.',
|
||||
),
|
||||
'last_comment_uid' => array(
|
||||
'type' => 'int',
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'description' => 'The user ID of the latest author to post a comment on this node, from {comments}.uid.',
|
||||
'description' => 'The user ID of the latest author to post a comment on this node, from {comment}.uid.',
|
||||
),
|
||||
'comment_count' => array(
|
||||
'type' => 'int',
|
||||
|
|
|
@ -324,7 +324,7 @@ function comment_get_recent($number = 10) {
|
|||
// Step 2: From among the comments on the nodes selected in the first query,
|
||||
// find the $number of most recent comments.
|
||||
// Using Query Builder here for the IN-Statement.
|
||||
$result = db_select('comments', 'c')
|
||||
$result = db_select('comment', 'c')
|
||||
->fields('c', array('nid', 'subject', 'cid', 'timestamp') )
|
||||
->innerJoin('node', 'n', 'n.nid = c.nid')
|
||||
->condition('c.nid', $nids, 'IN')
|
||||
|
@ -371,14 +371,14 @@ function comment_new_page_count($num_comments, $new_replies, $node) {
|
|||
// Threaded comments.
|
||||
// Find the first thread with a new comment.
|
||||
$result = db_query_range('(SELECT thread
|
||||
FROM {comments}
|
||||
FROM {comment}
|
||||
WHERE nid = :nid
|
||||
AND status = 0
|
||||
ORDER BY timestamp DESC)
|
||||
ORDER BY SUBSTRING(thread, 1, (LENGTH(thread) - 1))', array(':nid' => $node->nid), 0, $new_replies)
|
||||
->fetchField();
|
||||
$thread = substr($result, 0, -1);
|
||||
$count = db_query('SELECT COUNT(*) FROM {comments} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array(
|
||||
$count = db_query('SELECT COUNT(*) FROM {comment} WHERE nid = :nid AND status = 0 AND SUBSTRING(thread, 1, (LENGTH(thread) - 1)) < :thread', array(
|
||||
':nid' => $node->nid,
|
||||
':thread' => $thread))
|
||||
->fetchField();
|
||||
|
@ -613,7 +613,7 @@ function comment_nodeapi_insert(&$node, $arg = 0) {
|
|||
* Implementation of hook_nodeapi_delete().
|
||||
*/
|
||||
function comment_nodeapi_delete(&$node, $arg = 0) {
|
||||
db_delete('comments')
|
||||
db_delete('comment')
|
||||
->condition('nid', $node->nid)
|
||||
->execute();
|
||||
db_delete('node_comment_statistics')
|
||||
|
@ -626,7 +626,7 @@ function comment_nodeapi_delete(&$node, $arg = 0) {
|
|||
*/
|
||||
function comment_nodeapi_update_index(&$node, $arg = 0) {
|
||||
$text = '';
|
||||
$comments = db_query('SELECT subject, comment, format FROM {comments} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
|
||||
$comments = db_query('SELECT subject, comment, format FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $node->nid, ':status' => COMMENT_PUBLISHED));
|
||||
foreach ($comments as $comment) {
|
||||
$text .= '<h2>' . check_plain($comment->subject) . '</h2>' . check_markup($comment->comment, $comment->format, FALSE);
|
||||
}
|
||||
|
@ -657,7 +657,7 @@ function comment_nodeapi_rss_item(&$node, $arg = 0) {
|
|||
* Implementation of hook_user_delete().
|
||||
*/
|
||||
function comment_user_delete(&$edit, &$user, $category = NULL) {
|
||||
db_update('comments')
|
||||
db_update('comment')
|
||||
->fields(array('uid' => 0))
|
||||
->condition('uid', $user->uid)
|
||||
->execute();
|
||||
|
@ -722,7 +722,7 @@ function comment_save($edit) {
|
|||
);
|
||||
if ($edit['cid']) {
|
||||
// Update the comment in the database.
|
||||
db_update('comments')
|
||||
db_update('comment')
|
||||
->fields(array(
|
||||
'status' => $edit['status'],
|
||||
'timestamp' => $edit['timestamp'],
|
||||
|
@ -747,7 +747,7 @@ function comment_save($edit) {
|
|||
if ($edit['pid'] == 0) {
|
||||
// This is a comment with no parent comment (depth 0): we start
|
||||
// by retrieving the maximum thread level.
|
||||
$max = db_query('SELECT MAX(thread) FROM {comments} WHERE nid = :nid', array(':nid' => $edit['nid']))->fetchField();
|
||||
$max = db_query('SELECT MAX(thread) FROM {comment} WHERE nid = :nid', array(':nid' => $edit['nid']))->fetchField();
|
||||
// Strip the "/" from the end of the thread.
|
||||
$max = rtrim($max, '/');
|
||||
// Finally, build the thread field for this new comment.
|
||||
|
@ -762,7 +762,7 @@ function comment_save($edit) {
|
|||
// Strip the "/" from the end of the parent thread.
|
||||
$parent->thread = (string) rtrim((string) $parent->thread, '/');
|
||||
// Get the max value in *this* thread.
|
||||
$max = db_query("SELECT MAX(thread) FROM {comments} WHERE thread LIKE :thread AND nid = :nid", array(
|
||||
$max = db_query("SELECT MAX(thread) FROM {comment} WHERE thread LIKE :thread AND nid = :nid", array(
|
||||
':thread' => $parent->thread .'.%',
|
||||
':nid' => $edit['nid']))
|
||||
->fetchField();
|
||||
|
@ -791,7 +791,7 @@ function comment_save($edit) {
|
|||
$edit['name'] = $user->name;
|
||||
}
|
||||
|
||||
$edit['cid'] = db_insert('comments')
|
||||
$edit['cid'] = db_insert('comment')
|
||||
->fields(array(
|
||||
'nid' => $edit['nid'],
|
||||
'pid' => empty($edit['pid']) ? 0 : $edit['pid'],
|
||||
|
@ -986,7 +986,7 @@ function comment_render($node, $cid = 0) {
|
|||
|
||||
if ($cid && is_numeric($cid)) {
|
||||
// Single comment view.
|
||||
$query = db_select('comments', 'c');
|
||||
$query = db_select('comment', 'c');
|
||||
$query->fields('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') );
|
||||
$query->fields('u', array( 'uid', 'signature', 'picture', 'data', 'status') );
|
||||
$query->addField('u', 'name', 'registered_name');
|
||||
|
@ -1012,8 +1012,8 @@ function comment_render($node, $cid = 0) {
|
|||
//TODO Convert to dynamic queries once the pager query is updated to the new DBTNG API.
|
||||
|
||||
// Multiple comment view.
|
||||
$query_count = 'SELECT COUNT(*) FROM {comments} c WHERE c.nid = %d';
|
||||
$query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d';
|
||||
$query_count = 'SELECT COUNT(*) FROM {comment} c WHERE c.nid = %d';
|
||||
$query = 'SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.picture, u.data, c.thread, c.status FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.nid = %d';
|
||||
|
||||
$query_args = array($nid);
|
||||
if (!user_access('administer comments')) {
|
||||
|
@ -1102,20 +1102,20 @@ function comment_render($node, $cid = 0) {
|
|||
function comment_operations($action = NULL) {
|
||||
if ($action == 'publish') {
|
||||
$operations = array(
|
||||
'publish' => array(t('Publish the selected comments'), db_update('comments')->fields(array( 'status' => COMMENT_PUBLISHED)) ),
|
||||
'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_PUBLISHED)) ),
|
||||
'delete' => array(t('Delete the selected comments'), '')
|
||||
);
|
||||
}
|
||||
elseif ($action == 'unpublish') {
|
||||
$operations = array(
|
||||
'unpublish' => array(t('Unpublish the selected comments'), db_update('comments')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ),
|
||||
'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ),
|
||||
'delete' => array(t('Delete the selected comments'), '')
|
||||
);
|
||||
}
|
||||
else {
|
||||
$operations = array(
|
||||
'publish' => array(t('Publish the selected comments'), db_update('comments')->fields(array( 'status' => COMMENT_PUBLISHED)) ),
|
||||
'unpublish' => array(t('Unpublish the selected comments'), db_update('comments')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ),
|
||||
'publish' => array(t('Publish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_PUBLISHED)) ),
|
||||
'unpublish' => array(t('Unpublish the selected comments'), db_update('comment')->fields(array( 'status' => COMMENT_NOT_PUBLISHED)) ),
|
||||
'delete' => array(t('Delete the selected comments'), '')
|
||||
);
|
||||
}
|
||||
|
@ -1136,7 +1136,7 @@ function comment_operations($action = NULL) {
|
|||
* The comment object.
|
||||
*/
|
||||
function comment_load($cid) {
|
||||
return db_query('SELECT * FROM {comments} WHERE cid = :cid', array(':cid' => $cid))->fetchObject();
|
||||
return db_query('SELECT * FROM {comment} WHERE cid = :cid', array(':cid' => $cid))->fetchObject();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1151,7 +1151,7 @@ function comment_num_replies($pid) {
|
|||
static $cache;
|
||||
|
||||
if (!isset($cache[$pid])) {
|
||||
$cache[$pid] = db_query('SELECT COUNT(cid) FROM {comments} WHERE pid = :pid AND status = :status', array(
|
||||
$cache[$pid] = db_query('SELECT COUNT(cid) FROM {comment} WHERE pid = :pid AND status = :status', array(
|
||||
':pid' => $pid,
|
||||
':status' => COMMENT_PUBLISHED))
|
||||
->fetchField();
|
||||
|
@ -1181,7 +1181,7 @@ function comment_num_new($nid, $timestamp = 0) {
|
|||
$timestamp = ($timestamp > NODE_NEW_LIMIT ? $timestamp : NODE_NEW_LIMIT);
|
||||
|
||||
// Use the timestamp to retrieve the number of new comments.
|
||||
return db_query('SELECT COUNT(c.cid) FROM {node} n INNER JOIN {comments} c ON n.nid = c.nid WHERE n.nid = :nid AND timestamp > :timestamp AND c.status = :status', array(
|
||||
return db_query('SELECT COUNT(c.cid) FROM {node} n INNER JOIN {comment} c ON n.nid = c.nid WHERE n.nid = :nid AND timestamp > :timestamp AND c.status = :status', array(
|
||||
':nid' => $nid,
|
||||
':timestamp' => $timestamp,
|
||||
':status' => COMMENT_PUBLISHED ))
|
||||
|
@ -1564,7 +1564,7 @@ function comment_form_add_preview($form, &$form_state) {
|
|||
$output = ''; // Isn't this line a duplication of the first $output above?
|
||||
|
||||
if ($edit['pid']) {
|
||||
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
|
||||
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
|
||||
':cid' => $edit['pid'],
|
||||
':status' => COMMENT_PUBLISHED ))
|
||||
->fetchObject();
|
||||
|
@ -1907,11 +1907,11 @@ function _comment_get_display_setting($setting, $node) {
|
|||
* - comment_count: the total number of approved/published comments on this node.
|
||||
*/
|
||||
function _comment_update_node_statistics($nid) {
|
||||
$count = db_query('SELECT COUNT(cid) FROM {comments} WHERE nid = :nid AND status = :status', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED))->fetchField();
|
||||
$count = db_query('SELECT COUNT(cid) FROM {comment} WHERE nid = :nid AND status = :status', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED))->fetchField();
|
||||
|
||||
if ($count > 0) {
|
||||
// Comments exist.
|
||||
$last_reply = db_query_range('SELECT cid, name, timestamp, uid FROM {comments} WHERE nid = :nid AND status = :status ORDER BY cid DESC', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED), 0, 1)->fetchObject();
|
||||
$last_reply = db_query_range('SELECT cid, name, timestamp, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC', array(':nid' => $nid, ':status' => COMMENT_PUBLISHED), 0, 1)->fetchObject();
|
||||
db_update('node_comment_statistics')
|
||||
->fields( array(
|
||||
'comment_count' => $count,
|
||||
|
@ -2051,9 +2051,9 @@ function comment_unpublish_action($comment, $context = array()) {
|
|||
}
|
||||
else {
|
||||
$cid = $context['cid'];
|
||||
$subject = db_query('SELECT subject FROM {comments} WHERE cid = :cid', array(':cid', $cid))->fetchField();
|
||||
$subject = db_query('SELECT subject FROM {comment} WHERE cid = :cid', array(':cid', $cid))->fetchField();
|
||||
}
|
||||
db_update('comments')
|
||||
db_update('comment')
|
||||
->fields(array('status' => COMMENT_NOT_PUBLISHED,))
|
||||
->condition('cid', $cid)
|
||||
->execute();
|
||||
|
@ -2098,7 +2098,7 @@ function comment_unpublish_by_keyword_action_submit($form, $form_state) {
|
|||
function comment_unpublish_by_keyword_action($comment, $context) {
|
||||
foreach ($context['keywords'] as $keyword) {
|
||||
if (strstr($comment->comment, $keyword) || strstr($comment->subject, $keyword)) {
|
||||
db_update('comments')
|
||||
db_update('comment')
|
||||
->fields(array('status' => COMMENT_NOT_PUBLISHED,))
|
||||
->condition('cid', $comment->cid)
|
||||
->execute();
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
function comment_edit($cid) {
|
||||
global $user;
|
||||
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject();
|
||||
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid', array(':cid'=>$cid) )->fetchObject();
|
||||
$comment = drupal_unpack($comment);
|
||||
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
|
||||
|
||||
|
@ -69,7 +69,7 @@ function comment_reply($node, $pid = NULL) {
|
|||
// $pid indicates that this is a reply to a comment.
|
||||
if ($pid) {
|
||||
// Load the comment whose cid = $pid
|
||||
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comments} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
|
||||
$comment = db_query('SELECT c.*, u.uid, u.name AS registered_name, u.signature, u.picture, u.data FROM {comment} c INNER JOIN {users} u ON c.uid = u.uid WHERE c.cid = :cid AND c.status = :status', array(
|
||||
':cid'=>$pid,
|
||||
':status'=>COMMENT_PUBLISHED))->fetchObject();
|
||||
if ( $comment ) {
|
||||
|
|
|
@ -50,7 +50,7 @@ function filter_admin_overview_submit($form, &$form_state) {
|
|||
foreach ($form_state['values'] as $id => $data) {
|
||||
if (is_array($data) && isset($data['weight'])) {
|
||||
// Only update if this is a form element with weight.
|
||||
db_query("UPDATE {filter_formats} SET weight = %d WHERE format = %d", $data['weight'], $id);
|
||||
db_query("UPDATE {filter_format} SET weight = %d WHERE format = %d", $data['weight'], $id);
|
||||
}
|
||||
}
|
||||
drupal_set_message(t('The input format ordering has been saved.'));
|
||||
|
@ -179,7 +179,7 @@ function filter_admin_format_form(&$form_state, $format) {
|
|||
function filter_admin_format_form_validate($form, &$form_state) {
|
||||
if (!isset($form_state['values']['format'])) {
|
||||
$name = trim($form_state['values']['name']);
|
||||
$result = db_fetch_object(db_query("SELECT format FROM {filter_formats} WHERE name='%s'", $name));
|
||||
$result = db_fetch_object(db_query("SELECT format FROM {filter_format} WHERE name='%s'", $name));
|
||||
if ($result) {
|
||||
form_set_error('name', t('Filter format names need to be unique. A format named %name already exists.', array('%name' => $name)));
|
||||
}
|
||||
|
@ -198,21 +198,21 @@ function filter_admin_format_form_submit($form, &$form_state) {
|
|||
// Add a new filter format.
|
||||
if (!$format) {
|
||||
$new = TRUE;
|
||||
db_query("INSERT INTO {filter_formats} (name) VALUES ('%s')", $name);
|
||||
$format = db_result(db_query("SELECT MAX(format) AS format FROM {filter_formats}"));
|
||||
db_query("INSERT INTO {filter_format} (name) VALUES ('%s')", $name);
|
||||
$format = db_result(db_query("SELECT MAX(format) AS format FROM {filter_format}"));
|
||||
drupal_set_message(t('Added input format %format.', array('%format' => $name)));
|
||||
}
|
||||
else {
|
||||
drupal_set_message(t('The input format settings have been updated.'));
|
||||
}
|
||||
|
||||
db_query("DELETE FROM {filters} WHERE format = %d", $format);
|
||||
db_query("DELETE FROM {filter} WHERE format = %d", $format);
|
||||
foreach ($form_state['values']['filters'] as $id => $checked) {
|
||||
if ($checked) {
|
||||
list($module, $delta) = explode('/', $id);
|
||||
// Add new filters to the bottom.
|
||||
$weight = isset($current[$id]->weight) ? $current[$id]->weight : 10;
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", $format, $module, $delta, $weight);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", $format, $module, $delta, $weight);
|
||||
|
||||
// Check if there are any 'no cache' filters.
|
||||
$cache &= !module_invoke($module, 'filter', 'no cache', $delta);
|
||||
|
@ -237,7 +237,7 @@ function filter_admin_format_form_submit($form, &$form_state) {
|
|||
$roles = ',' . implode(',', $roles) . ',';
|
||||
}
|
||||
|
||||
db_query("UPDATE {filter_formats} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
|
||||
db_query("UPDATE {filter_format} SET cache = %d, name='%s', roles = '%s' WHERE format = %d", $cache, $name, $roles, $format);
|
||||
|
||||
cache_clear_all($format . ':', 'cache_filter', TRUE);
|
||||
|
||||
|
@ -258,7 +258,7 @@ function filter_admin_format_form_submit($form, &$form_state) {
|
|||
*/
|
||||
function filter_admin_delete() {
|
||||
$format = arg(4);
|
||||
$format = db_fetch_object(db_query('SELECT * FROM {filter_formats} WHERE format = %d', $format));
|
||||
$format = db_fetch_object(db_query('SELECT * FROM {filter_format} WHERE format = %d', $format));
|
||||
|
||||
if ($format) {
|
||||
if ($format->format != variable_get('filter_default_format', 1)) {
|
||||
|
@ -281,13 +281,13 @@ function filter_admin_delete() {
|
|||
* Process filter delete form submission.
|
||||
*/
|
||||
function filter_admin_delete_submit($form, &$form_state) {
|
||||
db_query("DELETE FROM {filter_formats} WHERE format = %d", $form_state['values']['format']);
|
||||
db_query("DELETE FROM {filters} WHERE format = %d", $form_state['values']['format']);
|
||||
db_query("DELETE FROM {filter_format} WHERE format = %d", $form_state['values']['format']);
|
||||
db_query("DELETE FROM {filter} WHERE format = %d", $form_state['values']['format']);
|
||||
|
||||
$default = variable_get('filter_default_format', 1);
|
||||
// Replace existing instances of the deleted format with the default format.
|
||||
db_query("UPDATE {node_revisions} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
|
||||
db_query("UPDATE {comments} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
|
||||
db_query("UPDATE {node_revision} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
|
||||
db_query("UPDATE {comment} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
|
||||
db_query("UPDATE {box} SET format = %d WHERE format = %d", $default, $form_state['values']['format']);
|
||||
|
||||
cache_clear_all($form_state['values']['format'] . ':', 'cache_filter', TRUE);
|
||||
|
@ -402,7 +402,7 @@ function theme_filter_admin_order($form) {
|
|||
function filter_admin_order_submit($form, &$form_state) {
|
||||
foreach ($form_state['values']['weights'] as $id => $weight) {
|
||||
list($module, $delta) = explode('/', $id);
|
||||
db_query("UPDATE {filters} SET weight = %d WHERE format = %d AND module = '%s' AND delta = %d", $weight, $form_state['values']['format'], $module, $delta);
|
||||
db_query("UPDATE {filter} SET weight = %d WHERE format = %d AND module = '%s' AND delta = %d", $weight, $form_state['values']['format'], $module, $delta);
|
||||
}
|
||||
drupal_set_message(t('The filter ordering has been saved.'));
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* Implementation of hook_schema().
|
||||
*/
|
||||
function filter_schema() {
|
||||
$schema['filters'] = array(
|
||||
$schema['filter'] = array(
|
||||
'description' => 'Table that maps filters (HTML corrector) to input formats (Filtered HTML).',
|
||||
'fields' => array(
|
||||
'fid' => array(
|
||||
|
@ -17,7 +17,7 @@ function filter_schema() {
|
|||
'type' => 'int',
|
||||
'not null' => TRUE,
|
||||
'default' => 0,
|
||||
'description' => 'Foreign key: The {filter_formats}.format to which this filter is assigned.',
|
||||
'description' => 'Foreign key: The {filter_format}.format to which this filter is assigned.',
|
||||
),
|
||||
'module' => array(
|
||||
'type' => 'varchar',
|
||||
|
@ -49,7 +49,7 @@ function filter_schema() {
|
|||
'list' => array('format', 'weight', 'module', 'delta'),
|
||||
),
|
||||
);
|
||||
$schema['filter_formats'] = array(
|
||||
$schema['filter_format'] = array(
|
||||
'description' => 'Stores input formats: custom groupings of filters, such as Filtered HTML.',
|
||||
'fields' => array(
|
||||
'format' => array(
|
||||
|
@ -122,3 +122,13 @@ function filter_update_7001() {
|
|||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename {filters} table to {filter} and {filter_formats} table to {filter_format}.
|
||||
*/
|
||||
function filter_update_7002() {
|
||||
$ret = array();
|
||||
db_rename_table($ret, 'filters', 'filter');
|
||||
db_rename_table($ret, 'filter_formats', 'filter_format');
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
@ -295,7 +295,7 @@ function filter_formats($index = NULL) {
|
|||
if (!isset($formats)) {
|
||||
$formats = array();
|
||||
|
||||
$query = db_select('filter_formats', 'f');
|
||||
$query = db_select('filter_format', 'f');
|
||||
$query->addField('f', 'format', 'format');
|
||||
$query->addField('f', 'name', 'name');
|
||||
$query->addField('f', 'roles', 'roles');
|
||||
|
@ -361,7 +361,7 @@ function filter_format_allowcache($format) {
|
|||
static $cache = array();
|
||||
$format = filter_resolve_format($format);
|
||||
if (!isset($cache[$format])) {
|
||||
$cache[$format] = db_result(db_query('SELECT cache FROM {filter_formats} WHERE format = %d', $format));
|
||||
$cache[$format] = db_result(db_query('SELECT cache FROM {filter_format} WHERE format = %d', $format));
|
||||
}
|
||||
return $cache[$format];
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ function filter_list_format($format) {
|
|||
|
||||
if (!isset($filters[$format])) {
|
||||
$filters[$format] = array();
|
||||
$result = db_query("SELECT * FROM {filters} WHERE format = %d ORDER BY weight, module, delta", $format);
|
||||
$result = db_query("SELECT * FROM {filter} WHERE format = %d ORDER BY weight, module, delta", $format);
|
||||
while ($filter = db_fetch_object($result)) {
|
||||
$list = module_invoke($filter->module, 'filter', 'list');
|
||||
if (isset($list) && is_array($list) && isset($list[$filter->delta])) {
|
||||
|
@ -560,7 +560,7 @@ function _filter_tips($format, $long = FALSE) {
|
|||
$formats = filter_formats();
|
||||
}
|
||||
else {
|
||||
$formats = array(db_fetch_object(db_query("SELECT * FROM {filter_formats} WHERE format = %d", $format)));
|
||||
$formats = array(db_fetch_object(db_query("SELECT * FROM {filter_format} WHERE format = %d", $format)));
|
||||
}
|
||||
|
||||
$tips = array();
|
||||
|
|
|
@ -51,7 +51,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
|
|||
$this->drupalPost('admin/settings/filters/' . $filtered . '/order', $edit, t('Save configuration'));
|
||||
$this->assertText(t('The filter ordering has been saved.'), t('Order saved successfully.'));
|
||||
|
||||
$result = db_query('SELECT * FROM {filters} WHERE format = %d ORDER BY weight ASC', $filtered);
|
||||
$result = db_query('SELECT * FROM {filter} WHERE format = %d ORDER BY weight ASC', $filtered);
|
||||
$filters = array();
|
||||
while ($filter = db_fetch_object($result)) {
|
||||
if ($filter->delta == $second_filter || $filter->delta == $first_filter) {
|
||||
|
@ -151,7 +151,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
|
|||
* @return Array Array containing filtered and full filter ids.
|
||||
*/
|
||||
function checkFilterFormats() {
|
||||
$result = db_query('SELECT format, name FROM {filter_formats}');
|
||||
$result = db_query('SELECT format, name FROM {filter_format}');
|
||||
|
||||
$filtered = -1;
|
||||
$full = -1;
|
||||
|
@ -174,7 +174,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
|
|||
* @return object Filter object.
|
||||
*/
|
||||
function getFilter($name) {
|
||||
return db_fetch_object(db_query("SELECT * FROM {filter_formats} WHERE name = '%s'", $name));
|
||||
return db_fetch_object(db_query("SELECT * FROM {filter_format} WHERE name = '%s'", $name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ class FilterTestCase extends DrupalWebTestCase {
|
|||
'filters[filter/' . $filter . ']' => TRUE,
|
||||
);
|
||||
$this->drupalPost('admin/settings/filters/add', $edit, t('Save configuration'));
|
||||
return db_fetch_object(db_query("SELECT * FROM {filter_formats} WHERE name = '%s'", $edit['name']));
|
||||
return db_fetch_object(db_query("SELECT * FROM {filter_format} WHERE name = '%s'", $edit['name']));
|
||||
}
|
||||
|
||||
function deleteFormat($format) {
|
||||
|
|
|
@ -15,7 +15,7 @@ function node_schema() {
|
|||
'not null' => TRUE,
|
||||
),
|
||||
'vid' => array(
|
||||
'description' => 'The current {node_revisions}.vid version identifier.',
|
||||
'description' => 'The current {node_revision}.vid version identifier.',
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
|
@ -210,7 +210,7 @@ function node_schema() {
|
|||
'primary key' => array('nid'),
|
||||
);
|
||||
|
||||
$schema['node_revisions'] = array(
|
||||
$schema['node_revision'] = array(
|
||||
'description' => 'Stores information about each saved version of a {node}.',
|
||||
'fields' => array(
|
||||
'nid' => array(
|
||||
|
@ -326,7 +326,7 @@ function node_schema() {
|
|||
'default' => '',
|
||||
),
|
||||
'has_body' => array(
|
||||
'description' => 'Boolean indicating whether this type uses the {node_revisions}.body field.',
|
||||
'description' => 'Boolean indicating whether this type uses the {node_revision}.body field.',
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
|
@ -397,6 +397,15 @@ function node_update_7000() {
|
|||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename {node_revisions} table to {node_revision}.
|
||||
*/
|
||||
function node_update_7001() {
|
||||
$ret = array();
|
||||
db_rename_table($ret, 'node_revisions', 'node_revision');
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* End of 6.x to 7.x updates
|
||||
*/
|
||||
|
|
|
@ -775,7 +775,7 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) {
|
|||
|
||||
// Retrieve a field list based on the site's schema.
|
||||
$fields = drupal_schema_fields_sql('node', 'n');
|
||||
$fields = array_merge($fields, drupal_schema_fields_sql('node_revisions', 'r'));
|
||||
$fields = array_merge($fields, drupal_schema_fields_sql('node_revision', 'r'));
|
||||
$fields = array_merge($fields, array('u.name', 'u.picture', 'u.data'));
|
||||
// Remove fields not needed in the query: n.vid and r.nid are redundant,
|
||||
// n.title is unnecessary because the node title comes from the
|
||||
|
@ -791,10 +791,10 @@ function node_load($param = array(), $revision = NULL, $reset = NULL) {
|
|||
// No db_rewrite_sql is applied so as to get complete indexing for search.
|
||||
if ($revision) {
|
||||
array_unshift($arguments, $revision);
|
||||
$node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.nid = n.nid AND r.vid = %d WHERE ' . $cond, $arguments));
|
||||
$node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revision} r ON r.nid = n.nid AND r.vid = %d WHERE ' . $cond, $arguments));
|
||||
}
|
||||
else {
|
||||
$node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revisions} r ON r.vid = n.vid WHERE ' . $cond, $arguments));
|
||||
$node = db_fetch_object(db_query('SELECT ' . $fields . ' FROM {node} n INNER JOIN {users} u ON u.uid = n.uid INNER JOIN {node_revision} r ON r.vid = n.vid WHERE ' . $cond, $arguments));
|
||||
}
|
||||
|
||||
if ($node && $node->nid) {
|
||||
|
@ -915,7 +915,7 @@ function node_save(&$node) {
|
|||
$node->is_new = TRUE;
|
||||
|
||||
// When inserting a node, $node->log must be set because
|
||||
// {node_revisions}.log does not (and cannot) have a default
|
||||
// {node_revision}.log does not (and cannot) have a default
|
||||
// value. If the user does not have permission to create
|
||||
// revisions, however, the form will not contain an element for
|
||||
// log so $node->log will be unset at this point.
|
||||
|
@ -997,10 +997,10 @@ function _node_save_revision(&$node, $uid, $update = NULL) {
|
|||
$temp_uid = $node->uid;
|
||||
$node->uid = $uid;
|
||||
if (isset($update)) {
|
||||
drupal_write_record('node_revisions', $node, $update);
|
||||
drupal_write_record('node_revision', $node, $update);
|
||||
}
|
||||
else {
|
||||
drupal_write_record('node_revisions', $node);
|
||||
drupal_write_record('node_revision', $node);
|
||||
}
|
||||
$node->uid = $temp_uid;
|
||||
}
|
||||
|
@ -1014,7 +1014,7 @@ function node_delete($nid) {
|
|||
|
||||
if (node_access('delete', $node)) {
|
||||
db_query('DELETE FROM {node} WHERE nid = %d', $node->nid);
|
||||
db_query('DELETE FROM {node_revisions} WHERE nid = %d', $node->nid);
|
||||
db_query('DELETE FROM {node_revision} WHERE nid = %d', $node->nid);
|
||||
|
||||
// Call the node-specific callback (if any):
|
||||
node_invoke($node, 'delete');
|
||||
|
@ -1417,7 +1417,7 @@ function node_ranking() {
|
|||
*/
|
||||
function node_user_delete(&$edit, &$user) {
|
||||
db_query('UPDATE {node} SET uid = 0 WHERE uid = %d', $user->uid);
|
||||
db_query('UPDATE {node_revisions} SET uid = 0 WHERE uid = %d', $user->uid);
|
||||
db_query('UPDATE {node_revision} SET uid = 0 WHERE uid = %d', $user->uid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1481,7 +1481,7 @@ function _node_revision_access($node, $op = 'view') {
|
|||
// different revisions so there is no need for a separate database check.
|
||||
// Also, if you try to revert to or delete the current revision, that's
|
||||
// not good.
|
||||
if ($is_current_revision && (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', $node->nid)) == 1 || $op == 'update' || $op == 'delete')) {
|
||||
if ($is_current_revision && (db_result(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = %d', $node->nid)) == 1 || $op == 'update' || $op == 'delete')) {
|
||||
$access[$node->vid] = FALSE;
|
||||
}
|
||||
elseif (user_access('administer nodes')) {
|
||||
|
@ -1699,7 +1699,7 @@ function node_last_changed($nid) {
|
|||
*/
|
||||
function node_revision_list($node) {
|
||||
$revisions = array();
|
||||
$result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revisions} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid);
|
||||
$result = db_query('SELECT r.vid, r.title, r.log, r.uid, n.vid AS current_vid, r.timestamp, u.name FROM {node_revision} r LEFT JOIN {node} n ON n.vid = r.vid INNER JOIN {users} u ON u.uid = r.uid WHERE r.nid = %d ORDER BY r.timestamp DESC', $node->nid);
|
||||
while ($revision = db_fetch_object($result)) {
|
||||
$revisions[$revision->vid] = $revision;
|
||||
}
|
||||
|
|
|
@ -575,12 +575,12 @@ function node_revision_delete_confirm($form_state, $node_revision) {
|
|||
|
||||
function node_revision_delete_confirm_submit($form, &$form_state) {
|
||||
$node_revision = $form['#node_revision'];
|
||||
db_query("DELETE FROM {node_revisions} WHERE nid = %d AND vid = %d", $node_revision->nid, $node_revision->vid);
|
||||
db_query("DELETE FROM {node_revision} WHERE nid = %d AND vid = %d", $node_revision->nid, $node_revision->vid);
|
||||
node_invoke_nodeapi($node_revision, 'delete_revision');
|
||||
watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title, '%revision' => $node_revision->vid));
|
||||
drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_get_types('name', $node_revision), '%title' => $node_revision->title)));
|
||||
$form_state['redirect'] = 'node/' . $node_revision->nid;
|
||||
if (db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d', $node_revision->nid)) > 1) {
|
||||
if (db_result(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = %d', $node_revision->nid)) > 1) {
|
||||
$form_state['redirect'] .= '/revisions';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
|
|||
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
|
||||
array('%revision-date' => format_date($nodes[1]->revision_timestamp),
|
||||
'@type' => 'Page', '%title' => $nodes[1]->title)), t('Revision deleted.'));
|
||||
$this->assertTrue(db_result(db_query('SELECT COUNT(vid) FROM {node_revisions} WHERE nid = %d and vid = %d', $node->nid, $nodes[1]->vid)) == 0, t('Revision not found.'));
|
||||
$this->assertTrue(db_result(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = %d and vid = %d', $node->nid, $nodes[1]->vid)) == 0, t('Revision not found.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
* Implementation of hook_install().
|
||||
*/
|
||||
function php_install() {
|
||||
$format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_formats} WHERE name = 'PHP code'"));
|
||||
$format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_format} WHERE name = 'PHP code'"));
|
||||
// Add a PHP code input format, if it does not exist. Do this only for the
|
||||
// first install (or if the format has been manually deleted) as there is no
|
||||
// reliable method to identify the format in an uninstall hook or in
|
||||
// subsequent clean installs.
|
||||
if (!$format_exists) {
|
||||
db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('PHP code', '', 0)");
|
||||
$format = db_result(db_query("SELECT MAX(format) FROM {filter_formats}"));
|
||||
db_query("INSERT INTO {filter_format} (name, roles, cache) VALUES ('PHP code', '', 0)");
|
||||
$format = db_result(db_query("SELECT MAX(format) FROM {filter_format}"));
|
||||
|
||||
// Enable the PHP evaluator filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format);
|
||||
|
||||
drupal_set_message(t('A !php-code input format has been created.', array('!php-code' => l('PHP code', 'admin/settings/filters/' . $format))));
|
||||
}
|
||||
|
|
|
@ -508,7 +508,7 @@ function search_index($sid, $type, $text) {
|
|||
$linknid = $match[1];
|
||||
if ($linknid > 0) {
|
||||
// Note: ignore links to uncachable nodes to avoid redirect bugs.
|
||||
$node = db_fetch_object(db_query('SELECT n.title, n.nid, n.vid, r.format FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid WHERE n.nid = %d', $linknid));
|
||||
$node = db_fetch_object(db_query('SELECT n.title, n.nid, n.vid, r.format FROM {node} n INNER JOIN {node_revision} r ON n.vid = r.vid WHERE n.nid = %d', $linknid));
|
||||
if (filter_format_allowcache($node->format)) {
|
||||
$link = TRUE;
|
||||
$linktitle = $node->title;
|
||||
|
|
|
@ -488,7 +488,7 @@ class DrupalWebTestCase {
|
|||
node_save($node);
|
||||
|
||||
// small hack to link revisions to our test user
|
||||
db_query('UPDATE {node_revisions} SET uid = %d WHERE vid = %d', $node->uid, $node->vid);
|
||||
db_query('UPDATE {node_revision} SET uid = %d WHERE vid = %d', $node->uid, $node->vid);
|
||||
return $node;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ function hook_cron() {
|
|||
* Query to be rewritten.
|
||||
* @param $primary_table
|
||||
* Name or alias of the table which has the primary key field for this query.
|
||||
* Typical table names would be: {blocks}, {comments}, {forum}, {node},
|
||||
* Typical table names would be: {block}, {comment}, {forum}, {node},
|
||||
* {menu}, {term_data} or {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
|
||||
|
@ -1346,7 +1346,7 @@ function hook_schema() {
|
|||
'unsigned' => TRUE,
|
||||
'not null' => TRUE),
|
||||
'vid' => array(
|
||||
'description' => t('The current {node_revisions}.vid version identifier.'),
|
||||
'description' => t('The current {node_revision}.vid version identifier.'),
|
||||
'type' => 'int',
|
||||
'unsigned' => TRUE,
|
||||
'not null' => TRUE,
|
||||
|
|
|
@ -385,28 +385,28 @@ function system_install() {
|
|||
db_query("INSERT INTO {node_access} (nid, gid, realm, grant_view, grant_update, grant_delete) VALUES (%d, %d, '%s', %d, %d, %d)", 0, 0, 'all', 1, 0, 0);
|
||||
|
||||
// Add input formats.
|
||||
db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('%s', '%s', %d)", 'Filtered HTML', ',1,2,', 1);
|
||||
db_query("INSERT INTO {filter_formats} (name, roles, cache) VALUES ('%s', '%s', %d)", 'Full HTML', '', 1);
|
||||
db_query("INSERT INTO {filter_format} (name, roles, cache) VALUES ('%s', '%s', %d)", 'Filtered HTML', ',1,2,', 1);
|
||||
db_query("INSERT INTO {filter_format} (name, roles, cache) VALUES ('%s', '%s', %d)", 'Full HTML', '', 1);
|
||||
|
||||
// Enable filters for each input format.
|
||||
|
||||
// Filtered HTML:
|
||||
// URL filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 2, 0);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 2, 0);
|
||||
// HTML filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 0, 1);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 0, 1);
|
||||
// Line break filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 1, 2);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 1, 2);
|
||||
// HTML corrector filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 3, 10);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 1, 'filter', 3, 10);
|
||||
|
||||
// Full HTML:
|
||||
// URL filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 2, 'filter', 2, 0);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 2, 'filter', 2, 0);
|
||||
// Line break filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 2, 'filter', 1, 1);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 2, 'filter', 1, 1);
|
||||
// HTML corrector filter.
|
||||
db_query("INSERT INTO {filters} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 2, 'filter', 3, 10);
|
||||
db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, '%s', %d, %d)", 2, 'filter', 3, 10);
|
||||
|
||||
db_query("INSERT INTO {variable} (name, value) VALUES ('%s','%s')", 'filter_html_1', 'i:1;');
|
||||
|
||||
|
@ -2137,7 +2137,7 @@ function system_update_6022() {
|
|||
|
||||
// The nid column was renamed to uid. Use the old nid to find the node's uid.
|
||||
update_sql('UPDATE {files} SET uid = (SELECT n.uid FROM {node} n WHERE {files}.uid = n.nid)');
|
||||
update_sql('UPDATE {upload} SET nid = (SELECT r.nid FROM {node_revisions} r WHERE {upload}.vid = r.vid)');
|
||||
update_sql('UPDATE {upload} SET nid = (SELECT r.nid FROM {node_revision} r WHERE {upload}.vid = r.vid)');
|
||||
|
||||
// Mark all existing files as FILE_STATUS_PERMANENT.
|
||||
$ret[] = update_sql('UPDATE {files} SET status = 1');
|
||||
|
|
|
@ -22,9 +22,9 @@ function tracker_page($account = NULL, $set_title = FALSE) {
|
|||
drupal_set_title($account->name);
|
||||
}
|
||||
// TODO: These queries are very expensive, see http://drupal.org/node/105639
|
||||
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
|
||||
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comment} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
|
||||
$sql = db_rewrite_sql($sql);
|
||||
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
|
||||
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comment} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
|
||||
$sql_count = db_rewrite_sql($sql_count);
|
||||
$result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $account->uid, $account->uid);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue