mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-06 15:45:34 +02:00
grmbl... another way to get your forum out of sync. ;)
git-svn-id: file:///svn/phpbb/trunk@4663 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
6a701d1cf5
commit
5f91c611d7
@ -591,66 +591,72 @@ function delete_attachments($mode, $ids, $resync = TRUE)
|
|||||||
$topic_ids = array_unique($topic_ids);
|
$topic_ids = array_unique($topic_ids);
|
||||||
|
|
||||||
// Update post indicators
|
// Update post indicators
|
||||||
if ($mode == 'post' || $mode == 'topic')
|
if (sizeof($post_ids))
|
||||||
{
|
{
|
||||||
$db->sql_query('UPDATE ' . POSTS_TABLE . '
|
if ($mode == 'post' || $mode == 'topic')
|
||||||
SET post_attachment = 0
|
|
||||||
WHERE post_id IN (' . implode(', ', $post_ids) . ')');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($mode == 'user' || $mode == 'attach')
|
|
||||||
{
|
|
||||||
$remaining = array();
|
|
||||||
|
|
||||||
$sql = 'SELECT post_id
|
|
||||||
FROM ' . ATTACHMENTS_TABLE . '
|
|
||||||
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
|
||||||
$remaining[] = $row['post_id'];
|
|
||||||
}
|
|
||||||
$db->sql_fetchrow($result);
|
|
||||||
|
|
||||||
$unset_ids = array_diff($post_ids, $remaining);
|
|
||||||
if (sizeof($delete_ids))
|
|
||||||
{
|
{
|
||||||
$db->sql_query('UPDATE ' . POSTS_TABLE . '
|
$db->sql_query('UPDATE ' . POSTS_TABLE . '
|
||||||
SET post_attachment = 0
|
SET post_attachment = 0
|
||||||
WHERE post_id IN (' . implode(', ', $unset_ids) . ')');
|
WHERE post_id IN (' . implode(', ', $post_ids) . ')');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Update topic indicator
|
if ($mode == 'user' || $mode == 'attach')
|
||||||
if ($mode == 'topic')
|
|
||||||
{
|
|
||||||
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
|
|
||||||
SET topic_attachment = 0
|
|
||||||
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($mode == 'post' || $mode == 'user' || $mode == 'attach')
|
|
||||||
{
|
|
||||||
$remaining = array();
|
|
||||||
|
|
||||||
$sql = 'SELECT topic_id
|
|
||||||
FROM ' . ATTACHMENTS_TABLE . '
|
|
||||||
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
|
|
||||||
$result = $db->sql_query($sql);
|
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
|
||||||
{
|
{
|
||||||
$remaining[] = $row['topic_id'];
|
$remaining = array();
|
||||||
}
|
|
||||||
$db->sql_fetchrow($result);
|
|
||||||
|
|
||||||
$unset_ids = array_diff($topic_ids, $remaining);
|
$sql = 'SELECT post_id
|
||||||
if (sizeof($unset_ids))
|
FROM ' . ATTACHMENTS_TABLE . '
|
||||||
|
WHERE post_id IN (' . implode(', ', $post_ids) . ')';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$remaining[] = $row['post_id'];
|
||||||
|
}
|
||||||
|
$db->sql_fetchrow($result);
|
||||||
|
|
||||||
|
$unset_ids = array_diff($post_ids, $remaining);
|
||||||
|
if (sizeof($unset_ids))
|
||||||
|
{
|
||||||
|
$db->sql_query('UPDATE ' . POSTS_TABLE . '
|
||||||
|
SET post_attachment = 0
|
||||||
|
WHERE post_id IN (' . implode(', ', $unset_ids) . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sizeof($topic_ids))
|
||||||
|
{
|
||||||
|
// Update topic indicator
|
||||||
|
if ($mode == 'topic')
|
||||||
{
|
{
|
||||||
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
|
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
|
||||||
SET topic_attachment = 0
|
SET topic_attachment = 0
|
||||||
WHERE topic_id IN (' . implode(', ', $unset_ids) . ')');
|
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mode == 'post' || $mode == 'user' || $mode == 'attach')
|
||||||
|
{
|
||||||
|
$remaining = array();
|
||||||
|
|
||||||
|
$sql = 'SELECT topic_id
|
||||||
|
FROM ' . ATTACHMENTS_TABLE . '
|
||||||
|
WHERE topic_id IN (' . implode(', ', $topic_ids) . ')';
|
||||||
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
while ($row = $db->sql_fetchrow($result))
|
||||||
|
{
|
||||||
|
$remaining[] = $row['topic_id'];
|
||||||
|
}
|
||||||
|
$db->sql_fetchrow($result);
|
||||||
|
|
||||||
|
$unset_ids = array_diff($topic_ids, $remaining);
|
||||||
|
if (sizeof($unset_ids))
|
||||||
|
{
|
||||||
|
$db->sql_query('UPDATE ' . TOPICS_TABLE . '
|
||||||
|
SET topic_attachment = 0
|
||||||
|
WHERE topic_id IN (' . implode(', ', $unset_ids) . ')');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user