mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 03:22:37 +02:00
[ticket/15950] Add SQL transactions to mcp_main.php
PHPBB3-15950 And simultaneously remove a duplicated UPDATE query.
This commit is contained in:
@@ -414,6 +414,8 @@ function change_topic_type($action, $topic_ids)
|
|||||||
|
|
||||||
if (confirm_box(true))
|
if (confirm_box(true))
|
||||||
{
|
{
|
||||||
|
$db->sql_transaction('begin');
|
||||||
|
|
||||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
||||||
SET topic_type = $new_topic_type
|
SET topic_type = $new_topic_type
|
||||||
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
|
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
|
||||||
@@ -425,13 +427,10 @@ function change_topic_type($action, $topic_ids)
|
|||||||
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
|
$sql = 'DELETE FROM ' . TOPICS_TABLE . '
|
||||||
WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);
|
WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids);
|
||||||
$db->sql_query($sql);
|
$db->sql_query($sql);
|
||||||
|
|
||||||
$sql = 'UPDATE ' . TOPICS_TABLE . "
|
|
||||||
SET topic_type = $new_topic_type
|
|
||||||
WHERE " . $db->sql_in_set('topic_id', $topic_ids);
|
|
||||||
$db->sql_query($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$db->sql_transaction('commit');
|
||||||
|
|
||||||
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
|
$success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED';
|
||||||
|
|
||||||
if (count($topic_ids))
|
if (count($topic_ids))
|
||||||
|
Reference in New Issue
Block a user