Copied to clipboard

Flag this post as spam?

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


  • Sean 10 posts 30 karma points
    Aug 31, 2012 @ 15:40
    Sean
    0

    Doesn't handle publishing and unpublishing exactly like Umbraco

    Hi,

    I've been using this tool at work, and its a real time saver! We really like it. However, we noticed that it does not publish and unpublish correctly. From what I see in the source code, it only updates the database. However, the cache file, content interface and lucene indexes are not being updated. This caused some big problems for a few projects we work on at my company. I was able to rewrite some of the code to get it to work for us, using these functions:

    library.UpdateDocumentCache();
    umbraco.library.RefreshContent();

    Also, I've noticed that this tool allows published nodes to become children of unpublished parents, but their publication status is not changed. Not sure why umbraco allows this, but I don't see why this would be a good thing.

    Overall, we love this tool at my workplace, and I hope these additions can be included!!

    Thanks.

  • Richard Barg 358 posts 532 karma points
    Jan 16, 2013 @ 19:14
    Richard Barg
    0

    Richard,

    Do you have any comments on this. For us, this would be a serious concern, as we would want all the valid files outside the db to be update.

    Is it a valid criticism and is the code above useful or  has it been incorporated. As noted, we're also interested in the internal package.

     

  • Amir Khan 1282 posts 2739 karma points
    Mar 11, 2013 @ 20:19
    Amir Khan
    0

    Hi Sean, can you elaborate more on how you were able to fix this? I'm experiencing the same issues...

  • Sean 10 posts 30 karma points
    Mar 18, 2013 @ 14:18
    Sean
    0

    Hi Amir,

    I had to download and alter the source code for this package to get it to work. My main problem was that it wasn't updating the indexes and umbraco.config properly. In this code I added a function

    private static void AddToIndex(int id)
    {
        Document document = new Document(id);
        if (document.Published)  //Add this to the indeces if it is published
        {
        foreach (Examine.Providers.BaseIndexProvider indexer in ExamineManager.Instance.IndexProviderCollection)
        {
            XElement xmlNode = XDocument.Parse(((library.GetXmlNodeById(id.ToString())).Current).OuterXml).Root;
            indexer.ReIndexNode(xmlNode, document.ContentType.Alias);
        }
        }
    }

    Deleting from an index can be done by:

    indexer.DeleteFromIndex(document.Id.ToString());

    I made a similar one to delete a node from the index, and would call them appropraitely in his code. I would then call

    library.UpdateDocumentCache();
    umbraco
    .library.RefreshContent();

    when needed to update the cache on UI. This may not be the most efficient code/strategy, but at the time that I wrote the code, I had a major time constraint and had to get the code working. After I made my changes, the tool still seems to running pretty fast, even when dealing with a lot of nodes, with many descendants.

    I hope you can get it to work for you! Good luck!

Please Sign in or register to post replies

Write your reply to:

Draft