? 712304-9_batch.patch
? 712304.feeds-batch.patch
? libraries/simplepie.inc
Index: feeds.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/feeds.install,v
retrieving revision 1.6
diff -u -p -r1.6 feeds.install
--- feeds.install	10 Feb 2010 23:49:35 -0000	1.6
+++ feeds.install	22 Feb 2010 22:20:07 -0000
@@ -75,7 +75,6 @@ function feeds_schema() {
         'size' => 'big',
         'not null' => FALSE,
         'description' => t('Cache for batching.'),
-        'serialize' => TRUE,
       ),
     ),
     'primary key' => array('id', 'feed_nid'),
@@ -362,4 +361,20 @@ function feeds_update_6008() {
   db_change_field($ret, 'feeds_schedule', 'last_scheduled_time', 'last_executed_time', $spec);
 
   return $ret;
+}
+
+/**
+ * Make batch field not serialized.
+ */
+function feeds_update_6009() {
+  $ret = array();
+  $spec = array(
+    'type' => 'text',
+    'size' => 'big',
+    'not null' => FALSE,
+    'description' => t('Cache for batching.'),
+    'serialize' => TRUE,
+  );
+  db_change_field($ret, 'feeds_source', 'batch', 'batch', $spec);
+  return $ret;
 }
\ No newline at end of file
Index: includes/FeedsBatch.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/includes/FeedsBatch.inc,v
retrieving revision 1.5
diff -u -p -r1.5 FeedsBatch.inc
--- includes/FeedsBatch.inc	18 Feb 2010 16:01:19 -0000	1.5
+++ includes/FeedsBatch.inc	22 Feb 2010 22:20:07 -0000
@@ -11,11 +11,14 @@ class FeedsBatch {
   public $created;
   public $updated;
   public $deleted;
+  public $processed;
+
   public function __construct() {
     $this->total = 0;
     $this->created = 0;
     $this->updated = 0;
     $this->deleted = 0;
+    $this->processed = 0;
   }
 }
 
Index: includes/FeedsSource.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/includes/FeedsSource.inc,v
retrieving revision 1.9
diff -u -p -r1.9 FeedsSource.inc
--- includes/FeedsSource.inc	18 Feb 2010 16:52:22 -0000	1.9
+++ includes/FeedsSource.inc	22 Feb 2010 22:20:07 -0000
@@ -189,7 +189,8 @@ class FeedsSource extends FeedsConfigura
       'feed_nid' => $this->feed_nid,
       'config' => $config,
       'source' => $source,
-      'batch' => isset($this->batch) ? $this->batch : FALSE,
+      // Use base64 encoding to support protected class members.
+      'batch' => base64_encode(serialize(isset($this->batch) ? $this->batch : FALSE)),
     );
     // Make sure a source record is present at all time, try to update first,
     // then insert.
@@ -211,7 +212,7 @@ class FeedsSource extends FeedsConfigura
       ctools_include('export');
       $this->export_type = EXPORT_IN_DATABASE;
       $this->config = unserialize($record->config);
-      $this->batch = unserialize($record->batch);
+      $this->batch = unserialize(base64_decode($record->batch));
     }
   }
 
Index: plugins/FeedsNodeProcessor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feeds/plugins/FeedsNodeProcessor.inc,v
retrieving revision 1.22
diff -u -p -r1.22 FeedsNodeProcessor.inc
--- plugins/FeedsNodeProcessor.inc	10 Feb 2010 23:49:35 -0000	1.22
+++ plugins/FeedsNodeProcessor.inc	22 Feb 2010 22:20:07 -0000
@@ -74,8 +74,10 @@ class FeedsNodeProcessor extends FeedsPr
       }
 
       $processed++;
+      $batch->processed++;
+
       if ($processed >= variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE)) {
-        return (1.0 / ($batch->total + 1)) * ($batch->updated + $batch->created); // Add + 1 to make sure that result is not 1.0 = finished.
+        return (1.0 / ($batch->total + 1)) * $batch->processed; // Add + 1 to make sure that result is not 1.0 = finished.
       }
     }
 
