aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-06-19 22:06:53 +0000
committerLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-06-19 22:06:53 +0000
commit4f2cf69b68fa85c46ed4a74430536b35bc1ab5a9 (patch)
tree66c81fe09f9badbb4a1df028edab37150c54adc6 /phpBB/includes/functions_admin.php
parent270c960a23d28828cfbabd44840d411f8e1bc957 (diff)
downloadforums-4f2cf69b68fa85c46ed4a74430536b35bc1ab5a9.tar
forums-4f2cf69b68fa85c46ed4a74430536b35bc1ab5a9.tar.gz
forums-4f2cf69b68fa85c46ed4a74430536b35bc1ab5a9.tar.bz2
forums-4f2cf69b68fa85c46ed4a74430536b35bc1ab5a9.tar.xz
forums-4f2cf69b68fa85c46ed4a74430536b35bc1ab5a9.zip
Fixed topics sync'ing - hopefully using correct linefeeds
git-svn-id: file:///svn/phpbb/trunk@4156 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php16
1 files changed, 6 insertions, 10 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 688240360d..a8e62044cb 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -514,7 +514,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
break;
default:
- $sql = 'SELECT t.post_id, t.post_attachment, COUNT(a.attachment_id) AS attachments
+ $sql = 'SELECT t.post_id, t.post_attachment, COUNT(a.attach_id) AS attachments
FROM ' . POSTS_TABLE . ' t
LEFT JOIN ' . ATTACHMENTS_TABLE . " a ON t.post_id = a.post_id
$where_sql
@@ -551,28 +551,24 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
break;
default:
- $sql = 'SELECT t.topic_id, t.topic_attachment, COUNT(a.attachment_id) AS attachments
+ $sql = 'SELECT t.topic_id, t.topic_attachment, a.attach_id
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p
LEFT JOIN ' . ATTACHMENTS_TABLE . " a ON p.post_id = a.post_id
$where_sql_and t.topic_id = p.topic_id
- AND ((t.topic_attachment = 1 AND attachments = 0)
- OR (t.topic_attachment = 0 AND attachments > 0))
- GROUP BY t.topic_id";
+ AND ((t.topic_attachment = 1 AND a.attach_id IS NULL)
+ OR (t.topic_attachment = 0 AND a.attach_id > 0))
+ GROUP BY p.topic_id";
}
$result = $db->sql_query($sql);
$topic_ids = array();
while ($row = $db->sql_fetchrow($result))
{
- if (($row['topic_attachment'] && !$row['attachments'])
- || ($row['attachments'] && !$row['topic_attachment']))
- {
$topic_ids[] = $row['topic_id'];
- }
}
$db->sql_freeresult($result);
- if (count($topic_ids))
+ if (!count($topic_ids))
{
return;
}