? drupal_queue_updates.patch
Index: media_mover_api.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_mover/media_mover_api.module,v
retrieving revision 1.1.2.110.2.47.2.67
diff -u -p -r1.1.2.110.2.47.2.67 media_mover_api.module
--- media_mover_api.module	25 Jul 2010 14:26:44 -0000	1.1.2.110.2.47.2.67
+++ media_mover_api.module	16 Aug 2010 16:03:25 -0000
@@ -68,6 +68,12 @@ define('MMA_ACTION_TYPE_ALL', 'all');
 function media_mover_api_cron() {
   // Can we use the Queue module?
   if (module_exists('drupal_queue')) {
+    // Make sure drupal_queue is included
+    drupal_queue_include();
+    
+    // Grab active configurations
+    $configurations = media_mover_api_configurations_get(MMA_CONFIG_STATUS_ENABLED);
+
     // Add harvest items to the queue
     $harvest_queue = DrupalQueue::get('media_mover_api_harvest');
     $file_queue = DrupalQueue::get('media_mover_api_process_file');
@@ -75,10 +81,10 @@ function media_mover_api_cron() {
       // Add the harvest step to the queue
       $harvest_queue->createItem($configuration->cid);
       // Find files ready for process
-      $files = $configuration->get_files(MM_FILE_STATUS_READY);
+      $files = $configuration->get_files(MMA_FILE_STATUS_READY);
       foreach ($files as $file) {
         $file->lock();
-        $harvest_queue->createItem($file);
+        $file_queue->createItem($file);
       }
     }
   }
@@ -231,8 +237,12 @@ function media_mover_api_disable() {
 function media_mover_api_file_worker($file) {
   // Load the configuration
   $configuration = media_mover_api_configuration_get($file->cid);
+
+  // Step to execute is one ahead of current file step
+  $step_order = $file->step_order++;
+
   // Run the configuration on this file
-  $configuration->steps[$file->step_order]->run($file);
+  $configuration->steps[$step_order]->run($file);
 }
 
 
@@ -243,7 +253,7 @@ function media_mover_api_file_worker($fi
  */
 function media_mover_api_harvest_worker($cid) {
   $configuration = media_mover_api_configuration_get($cid);
-  $configuration->steps[1]->run();
+  $configuration->steps[0]->run();
 }
 
 
