From 16eb932fcd8149171794a72b9e6f384eb12d2867 Mon Sep 17 00:00:00 2001
From: Dries Buytaert <dries@buytaert.net>
Date: Wed, 7 Jul 2010 00:57:44 +0000
Subject: [PATCH] - Patch #846254 by kiamlaluno: example for hook_update_N()
 contains wrong code.

---
 modules/system/system.api.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index adbc224b9475..497eb91557fc 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -2812,12 +2812,14 @@ function hook_update_N(&$sandbox) {
     // We'll -1 to disregard the uid 0...
     $sandbox['max'] = db_query('SELECT COUNT(DISTINCT uid) FROM {users}')->fetchField() - 1;
   }
-  db_select('users', 'u')
+
+  $users = db_select('users', 'u')
     ->fields('u', array('uid', 'name'))
     ->condition('uid', $sandbox['current_uid'], '>')
     ->range(0, 3)
     ->orderBy('uid', 'ASC')
     ->execute();
+
   foreach ($users as $user) {
     $user->name .= '!';
     db_update('users')
-- 
GitLab