Changeset 16735

Show
Ignore:
Timestamp:
06/29/08 11:10:43 (2 months ago)
Author:
rambo
Message:

check timestamp format, we might get objects with the core format in stead of midcom rewritten ones, return failure from http transport if all keys fail

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.helper.replicator/exporter/staging2live.php

    r16425 r16735  
    109109        // FIXME: use strtotime when MidCOM stops automagically rewriting these between ISO and Unix timestamps 
    110110        $schedule_action = 'ok'; 
    111         $schedulestart_unixtime = $object->metadata->schedulestart; 
    112         $scheduleend_unixtime = $object->metadata->scheduleend; 
     111        if (!preg_match('%[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}%', $object->metadata->schedulestart)) 
     112        { 
     113            $schedulestart_unixtime = strtotime($object->metadata->schedulestart); 
     114        } 
     115        else 
     116        { 
     117            $schedulestart_unixtime = $object->metadata->schedulestart; 
     118        } 
     119        if (!preg_match('%[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}%', $object->metadata->scheduleend)) 
     120        { 
     121            $scheduleend_unixtime = strtotime($object->metadata->scheduleend); 
     122        } 
     123        else 
     124        { 
     125            $scheduleend_unixtime = $object->metadata->scheduleend; 
     126        } 
    113127        if ($schedulestart_unixtime) 
    114128        { 
  • branches/MidCOM_2_8/midcom.helper.replicator/queuemanager.php

    r16429 r16735  
    636636            $GLOBALS['midcom_helper_replicator_logger']->log("Saving queue for later retry.", MIDCOM_LOG_ERROR); 
    637637            debug_pop(); 
    638             return; 
     638            // this is not a fatal error, return true 
     639            return true; 
    639640        } 
    640641 
  • branches/MidCOM_2_8/midcom.helper.replicator/transporter/http.php

    r16086 r16735  
    157157    function _real_process(&$items, $retry_count = 0) 
    158158    { 
     159        $orig_items_count = count($items); 
    159160        foreach ($items as $key => $data) 
    160161        { 
     
    196197        } 
    197198 
     199        $remaining_items_count = count($items); 
     200        if (   !empty($remaining_items_count) 
     201            && $orig_items_count === $remaining_items_count) 
     202        { 
     203            // All items failed send (likely unavailable target server), return false to retry in stead of quarantine 
     204            debug_push_class(__CLASS__, __FUNCTION__); 
     205            debug_add("\$remaining_items_count(={$remaining_items_count}) is the same as \$orig_items_count(={$orig_items_count}), all keys failed, marking for retry in stead on quarantine", MIDCOM_LOG_INFO); 
     206            debug_pop(); 
     207            $this->error = 'send failed for all keys'; 
     208            return false; 
     209        } 
    198210        return true; 
    199211    }