Copied to clipboard

Flag this post as spam?

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


  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jun 19, 2010 @ 15:37
    Morten Bock
    0

    Using uninstalling in package actions

    Hi everybody.

    I'm packaging up uForum (for Umbraco 4.1RC), and I would like some input on how the package actions work with regard to uninstalling.

    I too a look at the source, and it seems a bit unclear how I would make sure that an action has the undo method called when the package is uninstalled?

    The 4.1RC core seems to have this code:

    //Package Actions
    foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action")) {
    
        if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "false") {
            insPack.Data.Actions += n.OuterXml;
            Log.Add(LogTypes.Debug, -1, HttpUtility.HtmlEncode(n.OuterXml));
        }
    
        if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install") {
            try {
                packager.PackageAction.RunPackageAction(insPack.Data.Name, n.Attributes["alias"].Value, n);
            } catch {
    
            }
        }
    }

    It looks to me as, if I set the "undo" attribute to true, then the action is not saved for uninstalling. But if I set it to "false" or don't set it at all, then it _will_ be saved for uninstallation.

    So the correct action at this point is to not set it at all. Is that correct?

     

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Jun 19, 2010 @ 19:21
    Richard Soeteman
    0

    Hi Morten,

    This is an old bug which was fixed in a previous release but seems to came back again. But you are correct so in order to have an uninstall method just leave it.

    Cheers,

    Richard

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Jun 19, 2010 @ 19:27
    Morten Bock
    0

    Alrighty :-) Thanks.

Please Sign in or register to post replies

Write your reply to:

Draft