Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Lucy Hawker 2 posts 22 karma points
    Mar 18, 2013 @ 13:07
    Lucy Hawker
    0

    Problem with Courier Extraction Manager

    I’m having trouble with Courier Extraction Manager.   I’m using something similar to the sample ExtractionConsole code here: https://github.com/umbraco/Courier/blob/master/Samples/Umbraco.Courier.ExtractionConsole/Program.cs

     

    The Item Reource extraction event handler is only working after I have run the code twice (even though items are restored the first time the code is run). 

    For example, if I have all dictionary items in a revision.  If I rename content of 1 dictionary item, and delete 1 item.  Then I extract with this code:

    var engine = new RevisionExtraction(packageToExtract);
    engine.ExtractingItem += new EventHandler<ItemEventArgs>(ex_ExtractingItem);
    engine.ExtractingItemResources += new EventHandler<ItemEventArgs>(engine_ExtractingItemResources);

    And I get this output written to console:

    Extracting Item Resources: English (United Kingdom)
    Extracting Item Resources: HolidayTypes.Beach
    Extracting Item Resources: HolidayTypes.CityBreak
    Extracting Item Resources: HolidayTypes
    Extracting Item Resources: HolidayTypes.Coach
    Extracting Item Resources: HolidayTypes.Events
    Extracting Item Resources: HolidayTypes.Jersey
    Extracting Item Resources: HolidayTypes.Cruises
    Extracting Item: English (United Kingdom)
    Extracting Item: HolidayTypes
    Extracting Item: HolidayTypes.Beach
    Extracting Item: HolidayTypes.CityBreak
    Extracting Item: HolidayTypes.Coach
    Extracting Item: HolidayTypes.Events
    Extracting Item: HolidayTypes.Jersey
    Extracting Item: HolidayTypes.Cruises
    
    
    ======================================
    DONE!
    ======================================

    It looks like it should have been successful.  The deleted item is restored, but renamed content is not restored.

    If I run the code again, the output from the console is exactly the same.  But this time the renamed content is successfully restored.

    I have these values set to ‘Always’

    engine.DependencyOverwritemode = Umbraco.Courier.Core.Enums.OverwriteMode.Always;
    engine.ResourceOverwritemode = Umbraco.Courier.Core.Enums.OverwriteMode.Always;
    engine.ItemOverwritemode = Umbraco.Courier.Core.Enums.OverwriteMode.Always;

    It happens like this each time.  Any ideas why this is only working on second run?

  • Per Ploug 865 posts 3491 karma points MVP admin
    Mar 19, 2013 @ 09:32
    Per Ploug
    0

    hmm, cant really say why, maybe courier doesnt recognise you made a change to overwrite in the case of the renaming of the item. 

    Try Hooking into the Extracted event instead, this will give you the item and its itemstatus back, which provides abit more debugging info, so we can atleast see if they got through the extraction phase succesfully

  • Per Ploug 865 posts 3491 karma points MVP admin
    Mar 19, 2013 @ 09:34
    Per Ploug
    0

    One other thing, try checking the database for the actual values, and not just the tree, as there might be some caching that is messing with this.

  • Lucy Hawker 2 posts 22 karma points
    Mar 20, 2013 @ 20:02
    Lucy Hawker
    0

     

    Hi Per,

    Thanks for your replies. 

    I tried hooking in to the Extracted Item and Extracted Item Resource events.  On both the first and second run the output is the same.  It shows all status as “Extracted”, but  the Item Values are not actually updated until the second run (although any deleted content is restored on the first run).

    Here’s the console output: 

    Extracted Item: English (United Kingdom)
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes.Cruises
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes.Beach
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes.Events
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes.CityBreak
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes.Jersey
    Extracted Item Status: Extracted
    Extracted Item: HolidayTypes.Coach
    Extracted Item Status: Extracted
    Extraction complete

    ======================================
    DONE!
    ======================================
     

    I checked the database, and the values are not updated on the first run.

    Currently I’ve set it to run twice to get around this, but it’s a bit of an annoying hack!

    Any other ideas?

     

     

Please Sign in or register to post replies

Write your reply to:

Draft