Changeset 16296
- Timestamp:
- 05/02/08 17:29:01 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.replicator/queuemanager.php
r16099 r16296 512 512 /** 513 513 * Helper for process_queue, gets items for given queue directory pointer 514 */ 515 function _process_queue_get_items(&$dp_queue, &$queue_path, &$subscription) 514 * @todo use list_path_items ?? 515 */ 516 function _process_queue_get_items(&$queue_path, &$subscription) 516 517 { 517 518 // Start crunching each file into key => XML array … … 521 522 $items_sort = array(); 522 523 $GLOBALS['_process_queue_get_items__items_sort'] =& $items_sort; 523 while (($queue_item = readdir($dp_queue)) !== false) 524 { 525 if ( $queue_item == '.' 526 || $queue_item == '..' 527 || $queue_item == 'quarantine') 528 { 529 // Skip the . and .. entries (which are always present) & old style quarantine dir 530 continue; 531 } 532 $item_path = "{$queue_path}/{$queue_item}"; 524 $files = $this->list_path_items($queue_path); 525 foreach ($files as $item_path) 526 { 527 $queue_item = basename($item_path); 533 528 if ( !is_readable($item_path) 534 529 || !is_file($item_path)) … … 605 600 $queue_path = "{$subscription_path}/{$queue_name}"; 606 601 607 // Open handle608 $dp_queue = opendir($queue_path);609 if (!$dp_queue)610 {611 debug_add("Cannot open queue path '{$queue_path}' for reading", MIDCOM_LOG_ERROR);612 debug_pop();613 return;614 }615 616 602 // Get us the transporter 617 603 $transporter = midcom_helper_replicator_transporter::create($subscription); … … 626 612 * TODO: Read only X items to memory at a time ? 627 613 */ 628 $items_ret = $this->_process_queue_get_items($ dp_queue, $queue_path, $subscription);614 $items_ret = $this->_process_queue_get_items($queue_path, $subscription); 629 615 if ($items_ret === false) 630 616 { 631 closedir($dp_queue);632 617 debug_add("Fatal error while reading items in {$queue_name}", MIDCOM_LOG_ERROR); 633 618 debug_pop(); … … 636 621 $items =& $items_ret[0]; 637 622 $items_paths =& $items_ret[1]; 638 639 closedir($dp_queue);640 623 641 624 if (!$transporter->process($items))
