Performance: Use only one INSERT INTO (with multiple rows) for tracked cites
This commit is contained in:
parent
0bb254fdb3
commit
d7fc5adc22
13
post.php
13
post.php
@ -682,15 +682,14 @@ if (isset($_POST['delete'])) {
|
|||||||
incrementSpamHash($post['antispam_hash']);
|
incrementSpamHash($post['antispam_hash']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($post['tracked_cites'])) {
|
if (isset($post['tracked_cites']) && count($post['tracked_cites'])) {
|
||||||
|
$insert_rows = array();
|
||||||
foreach ($post['tracked_cites'] as $cite) {
|
foreach ($post['tracked_cites'] as $cite) {
|
||||||
$query = prepare('INSERT INTO ``cites`` VALUES (:board, :post, :target_board, :target)');
|
$insert_rows[] = '(' .
|
||||||
$query->bindValue(':board', $board['uri']);
|
$pdo->quote($board['uri']) . ', ' . (int)$id . ', ' .
|
||||||
$query->bindValue(':post', $id, PDO::PARAM_INT);
|
$pdo->quote($cite[0]) . ', ' . (int)$cite[1] . ')';
|
||||||
$query->bindValue(':target_board',$cite[0]);
|
|
||||||
$query->bindValue(':target', $cite[1], PDO::PARAM_INT);
|
|
||||||
$query->execute() or error(db_error($query));
|
|
||||||
}
|
}
|
||||||
|
query('INSERT INTO ``cites`` VALUES ' . implode(', ', $insert_rows)) or error(db_error());;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies']+1 < $config['reply_limit'])) {
|
if (!$post['op'] && strtolower($post['email']) != 'sage' && !$thread['sage'] && ($config['reply_limit'] == 0 || $numposts['replies']+1 < $config['reply_limit'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user