- Fixed bug #19432, modified patch from Junyor: database update fails when a name contains a quote.

4.7.x
Dries Buytaert 2005-04-08 12:28:14 +00:00
parent 67f7d6947e
commit 58b326a838
1 changed files with 1 additions and 2 deletions

View File

@ -2282,8 +2282,7 @@ function update_124() {
$result = db_query("SELECT c.nid, c.timestamp, c.name, c.uid, COUNT(c.nid) as comment_count FROM {node} n LEFT JOIN {comments} c ON c.nid = n.nid WHERE c.status = 0 GROUP BY c.nid, c.timestamp, c.name, c.uid");
while ($comment_record = db_fetch_object($result)) {
$count = db_result(db_query('SELECT COUNT(cid) FROM {comments} WHERE nid = %d AND status = 0', $comment_record->nid));
$ret[] = update_sql("UPDATE {node_comment_statistics} SET comment_count = $count, last_comment_timestamp = $comment_record->timestamp, last_comment_name = '$comment_record->name', last_comment_uid = $comment_record->uid WHERE nid = $comment_record->nid");
}
$ret[] = db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, $comment_record->timestamp, $comment_record->name, $comment_record->uid, $comment_record->nid);
return $ret;
}