Index: l10n_update.check.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/l10n_update/Attic/l10n_update.check.inc,v
retrieving revision 1.3.2.7.2.2
diff -u -r1.3.2.7.2.2 l10n_update.check.inc
--- l10n_update.check.inc	10 Jan 2011 21:21:04 -0000	1.3.2.7.2.2
+++ l10n_update.check.inc	22 Jan 2011 11:56:19 -0000
@@ -108,27 +108,27 @@
 function l10n_update_check_translations($count, $before, $limit = 1) {
   $projects = l10n_update_get_projects();
   $updated = $checked = array();
-  
+
   // Select active projects x languages ordered by last checked time
   $q = db_select('l10n_update_project', 'p');
-    $q->innerJoin('languages', 'l');
-    $q->leftJoin('l10n_update_file', 'f', 'p.name = f.project AND l.language = f.language');
-    $q->condition('p.status', 1);
-    $q->condition('l.enabled', 1);
-    // If the file is not there, or it is there, but we did not check since $before.
-    $q->condition(db_or()->isNull('f.status')->condition(db_and()->condition('f.status', 1)->condition('f.last_checked', $before, '<')));
-    $q->range(0, $count);
-    $q->fields('p', array('name'));
-    $q->fields('f');
-    $q->addField('l', 'language', 'lang');
-    $q->orderBy('last_checked');
-    $result = $q->execute();
-  
+  $q->innerJoin('languages', 'l');
+  $q->leftJoin('l10n_update_file', 'f', 'p.name = f.project AND l.language = f.language');
+  $q->condition('p.status', 1);
+  $q->condition('l.enabled', 1);
+  // If the file is not there, or it is there, but we did not check since $before.
+  $q->condition(db_or()->isNull('f.status')->condition(db_and()->condition('f.status', 1)->condition('f.last_checked', $before, '<')));
+  $q->range(0, $count);
+  $q->fields('p', array('name'));
+  $q->fields('f');
+  $q->addField('l', 'language', 'lang');
+  $q->orderBy('last_checked');
+  $result = $q->execute();
+
   if ($result) {
     $local = variable_get('l10n_update_check_mode', L10N_UPDATE_CHECK_ALL) & L10N_UPDATE_CHECK_LOCAL;
     $remote = variable_get('l10n_update_check_mode', L10N_UPDATE_CHECK_ALL) & L10N_UPDATE_CHECK_REMOTE;
     foreach ($result as $check) {
-      if (count($files) > $limit) {
+      if (count($checked) > $limit) {
         break;
       }
       $checked[] = $check;
@@ -136,8 +136,8 @@
         $project = $projects[$check->name];
         $update = NULL;
         $source = l10n_update_source_build($project, $check->lang);
+        $current = $check->filename ? $check : NULL;
         if ($available = l10n_update_source_check($source, $local, $remote)) {
-          $current = $check->filename ? $check : NULL;
           if (!$current || _l10n_update_source_compare($current, $available) > 1 || $current->version != $available->version) {
             $update = $available;
           }

