aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_admin.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2002-04-02 14:04:18 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2002-04-02 14:04:18 +0000
commit51d9bdeca72e22dfa2f7cecc3e7867b125ee899b (patch)
tree679053f4374226e2bdfb02af19f942b842040354 /phpBB/includes/functions_admin.php
parent374f7adca2dd41e3a20739c74514fbca87a01e55 (diff)
downloadforums-51d9bdeca72e22dfa2f7cecc3e7867b125ee899b.tar
forums-51d9bdeca72e22dfa2f7cecc3e7867b125ee899b.tar.gz
forums-51d9bdeca72e22dfa2f7cecc3e7867b125ee899b.tar.bz2
forums-51d9bdeca72e22dfa2f7cecc3e7867b125ee899b.tar.xz
forums-51d9bdeca72e22dfa2f7cecc3e7867b125ee899b.zip
Various updates with any luck they fix a few minor issues without causing new ones ...
git-svn-id: file:///svn/phpbb/trunk@2462 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_admin.php')
-rw-r--r--phpBB/includes/functions_admin.php27
1 files changed, 11 insertions, 16 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index 5d5df857fa..456742fd38 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -90,9 +90,11 @@ function sync($type, $id)
break;
case 'forum':
- $sql = "SELECT MAX(post_id) AS last_post, COUNT(post_id) AS total
- FROM " . POSTS_TABLE . "
- WHERE forum_id = $id";
+ $sql = "SELECT MAX(p.post_id) AS last_post, COUNT(p.post_id) AS total
+ FROM " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t
+ WHERE p.forum_id = $id
+ AND t.topic_id = p.topic_id
+ AND t.topic_status <> " . TOPIC_MOVED;
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
@@ -118,21 +120,14 @@ function sync($type, $id)
message_die(GENERAL_ERROR, 'Could not get topic count', '', __LINE__, __FILE__, $sql);
}
- if ( $row = $db->sql_fetchrow($result) )
- {
- $total_topics = ($row['total']) ? $row['total'] : 0;
- }
- else
- {
- $total_topics = 0;
- }
+ $total_topics = ( $row = $db->sql_fetchrow($result) ) ? ( ( $row['total'] ) ? $row['total'] : 0 ) : 0;
$sql = "UPDATE " . FORUMS_TABLE . "
SET forum_last_post_id = $last_post, forum_posts = $total_posts, forum_topics = $total_topics
WHERE forum_id = $id";
- if ( !$result = $db->sql_query($sql) )
+ if ( !$db->sql_query($sql) )
{
- message_die(GENERAL_ERROR, "Could not update forum $id", '', __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, 'Could not update forum', '', __LINE__, __FILE__, $sql);
}
break;
@@ -142,7 +137,7 @@ function sync($type, $id)
WHERE topic_id = $id";
if ( !$result = $db->sql_query($sql) )
{
- message_die(GENERAL_ERROR, "Could not get post ID", '', __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, 'Could not get post ID', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
@@ -150,9 +145,9 @@ function sync($type, $id)
$sql = "UPDATE " . TOPICS_TABLE . "
SET topic_replies = " . ( $row['total_posts'] - 1 ) . ", topic_first_post_id = " . $row['first_post'] . ", topic_last_post_id = " . $row['last_post'] . "
WHERE topic_id = $id";
- if ( !($result = $db->sql_query($sql)) )
+ if ( !$db->sql_query($sql) )
{
- message_die(GENERAL_ERROR, "Could not update topic $id", '', __LINE__, __FILE__, $sql);
+ message_die(GENERAL_ERROR, 'Could not update topic', '', __LINE__, __FILE__, $sql);
}
}