- Patch #1120412 by skwashd: comment_save() doesn't support additional columns added by hook_schema_alter().
parent
faf984175f
commit
07550714ea
|
@ -1465,21 +1465,8 @@ function comment_save($comment) {
|
||||||
module_invoke_all('entity_presave', $comment, 'comment');
|
module_invoke_all('entity_presave', $comment, 'comment');
|
||||||
|
|
||||||
if ($comment->cid) {
|
if ($comment->cid) {
|
||||||
// Update the comment in the database.
|
|
||||||
db_update('comment')
|
drupal_write_record('comment', $comment, 'cid');
|
||||||
->fields(array(
|
|
||||||
'status' => $comment->status,
|
|
||||||
'created' => $comment->created,
|
|
||||||
'changed' => $comment->changed,
|
|
||||||
'subject' => $comment->subject,
|
|
||||||
'uid' => $comment->uid,
|
|
||||||
'name' => $comment->name,
|
|
||||||
'mail' => $comment->mail,
|
|
||||||
'homepage' => $comment->homepage,
|
|
||||||
'language' => $comment->language,
|
|
||||||
))
|
|
||||||
->condition('cid', $comment->cid)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
// Ignore slave server temporarily to give time for the
|
// Ignore slave server temporarily to give time for the
|
||||||
// saved comment to be propagated to the slave.
|
// saved comment to be propagated to the slave.
|
||||||
|
@ -1551,23 +1538,16 @@ function comment_save($comment) {
|
||||||
$comment->name = $user->name;
|
$comment->name = $user->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment->cid = db_insert('comment')
|
// Ensure the parent id (pid) has a value set.
|
||||||
->fields(array(
|
if (empty($comment->pid)) {
|
||||||
'nid' => $comment->nid,
|
$comment->pid = 0;
|
||||||
'pid' => empty($comment->pid) ? 0 : $comment->pid,
|
}
|
||||||
'uid' => $comment->uid,
|
|
||||||
'subject' => $comment->subject,
|
// Add the values which aren't passed into the function.
|
||||||
'hostname' => ip_address(),
|
$comment->thread = $thread;
|
||||||
'created' => $comment->created,
|
$comment->hostname = ip_address();
|
||||||
'changed' => $comment->changed,
|
|
||||||
'status' => $comment->status,
|
drupal_write_record('comment', $comment);
|
||||||
'thread' => $thread,
|
|
||||||
'name' => $comment->name,
|
|
||||||
'mail' => $comment->mail,
|
|
||||||
'homepage' => $comment->homepage,
|
|
||||||
'language' => $comment->language,
|
|
||||||
))
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
// Ignore slave server temporarily to give time for the
|
// Ignore slave server temporarily to give time for the
|
||||||
// created comment to be propagated to the slave.
|
// created comment to be propagated to the slave.
|
||||||
|
|
Loading…
Reference in New Issue