aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenky <jakubsenko@gmail.com>2012-05-17 20:01:44 +0200
committerOleg Pudeyev <oleg@bsdpower.com>2012-12-05 12:07:37 -0500
commitdd6983b14bba4326d824b3abb130eafc5e8f666c (patch)
tree292b2ad0b855ccd981afe209720103fb38eda5b3
parentaf064cdaad357f705fc7c80f4d018d57cffa8d33 (diff)
downloadforums-dd6983b14bba4326d824b3abb130eafc5e8f666c.tar
forums-dd6983b14bba4326d824b3abb130eafc5e8f666c.tar.gz
forums-dd6983b14bba4326d824b3abb130eafc5e8f666c.tar.bz2
forums-dd6983b14bba4326d824b3abb130eafc5e8f666c.tar.xz
forums-dd6983b14bba4326d824b3abb130eafc5e8f666c.zip
[ticket/10841] changing affectedrows check to COUNT in sql
this sould reduce load and be faster. Also freeresult functions added PHPBB3-10841
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php14
1 files changed, 8 insertions, 6 deletions
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index 19e1b45787..b95d2d4ee8 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -134,11 +134,11 @@ class ucp_prefs
}
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
- // check for count of installed languages
- $sql = 'SELECT lang_id
+ // check if there are any user-selectable languages
+ $sql = 'SELECT COUNT(lang_id) as languages_count
FROM ' . LANG_TABLE;
$result = $db->sql_query($sql);
- if( $db->sql_affectedrows() > 1 )
+ if( $db->sql_fetchfield('languages_count') > 1 )
{
$s_more_languages = true;
}
@@ -146,13 +146,14 @@ class ucp_prefs
{
$s_more_languages = false;
}
+ $db->sql_freeresult($result);
- // check for count of installed and active styles
- $sql = 'SELECT style_id
+ // check if there are any user-selectable styles
+ $sql = 'SELECT COUNT(style_id) as styles_count
FROM ' . STYLES_TABLE . '
WHERE style_active = 1';
$result = $db->sql_query($sql);
- if( $db->sql_affectedrows() > 1 )
+ if( $db->sql_fetchfield('styles_count') > 1 )
{
$s_more_styles = true;
}
@@ -160,6 +161,7 @@ class ucp_prefs
{
$s_more_styles = false;
}
+ $db->sql_freeresult($result);
$template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',