summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-08-18 20:03:19 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-08-18 20:03:19 +0000
commit8971add8493d49ed0e170a2521a62f2f0f39137c (patch)
treed22f43ae4213b84c1089e7c12aa31c9220e77dd3 /modules
parent5d31f59573b8a559b06842b7f90cc2bd588025a2 (diff)
downloadbrdo-8971add8493d49ed0e170a2521a62f2f0f39137c.tar.gz
brdo-8971add8493d49ed0e170a2521a62f2f0f39137c.tar.bz2
#163191 follow up patch by hswong3i and pwolanin: use a has_rows flag where we dont need a counter
Diffstat (limited to 'modules')
-rw-r--r--modules/system/system.install7
-rw-r--r--modules/taxonomy/taxonomy.module6
-rw-r--r--modules/user/user.module6
3 files changed, 10 insertions, 9 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index e0aa4d35e..56205fdc9 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2169,7 +2169,8 @@ function system_update_179() {
$limit = 20;
$args = array_merge(array($_SESSION['system_update_179_uid'], $_SESSION['system_update_179_fid'], $_SESSION['system_update_179_uid']), $_SESSION['system_update_179_fields']);
$result = db_query_range("SELECT fid, uid, value FROM {profile_values} WHERE ((uid = %d AND fid > %d) OR uid > %d) AND fid IN ". $_SESSION['system_update_179_field_string'] .' ORDER BY uid ASC, fid ASC', $args, 0, $limit);
- $num_rows = 0;
+
+ $has_rows = FALSE;
while ($field = db_fetch_object($result)) {
$_SESSION['system_update_179_uid'] = $field->uid;
$_SESSION['system_update_179_fid'] = $field->fid;
@@ -2177,11 +2178,11 @@ function system_update_179() {
if ($field->value !== FALSE) {
db_query("UPDATE {profile_values} SET value = '%s' WHERE uid = %d AND fid = %d", $field->value, $field->uid, $field->fid);
}
- $num_rows++;
+ $has_rows = TRUE;
}
// Done?
- if ($num_rows == 0) {
+ if (!$has_rows) {
unset($_SESSION['system_update_179_uid']);
unset($_SESSION['system_update_179_fid']);
unset($_SESSION['system_update_179_max']);
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 738448e97..b557a810a 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -983,12 +983,12 @@ function taxonomy_select_nodes($tids = array(), $operator = 'or', $depth = 0, $p
*/
function taxonomy_render_nodes($result) {
$output = '';
- $num_rows = 0;
+ $has_rows = FALSE;
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
- $num_rows++;
+ $has_rows = TRUE;
}
- if ($num_rows > 0) {
+ if ($has_rows) {
$output .= theme('pager', NULL, variable_get('default_nodes_main', 10), 0);
}
else {
diff --git a/modules/user/user.module b/modules/user/user.module
index 56f0419b3..fdce324ab 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1098,12 +1098,12 @@ function user_current_to_arg($arg) {
function user_get_authmaps($authname = NULL) {
$result = db_query("SELECT authname, module FROM {authmap} WHERE authname = '%s'", $authname);
$authmaps = array();
- $num_rows = 0;
+ $has_rows = FALSE;
while ($authmap = db_fetch_object($result)) {
$authmaps[$authmap->module] = $authmap->authname;
- $num_rows++;
+ $has_rows = TRUE;
}
- return $num_rows > 0 ? $authmaps : 0;
+ return $has_rows ? $authmaps : 0;
}
function user_set_authmaps($account, $authmaps) {