Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsOther Extension...Other Extension...How to run code on extension installation/upgrade?How to run code on extension installation/upgrade?
Previous
 
Next
New Post
3/18/2014 8:31 PM
 

Is there way to wire up a block of code to execute when a DNN module/extension is installed and/or upgraded?

 I'm looking for a method of programatically creating an Admin page within the DNN instance as part of my custom module, and have that page automatically get setup when the extension is installed. Also, a method of automatically removing that page when the module/extension is uninstalled would be nice too.

Thank you for any suggestions.

 
New Post
3/19/2014 5:11 AM
 
   As far as I know. DNN doesn't provide any method to let you execute your code after install (or uninstall). I recommend you try do it in your module instance. For example, when user put your module on a page first time, you can execute your code (to create page, or something else). Of course, you need to create something to indicate that it is the first run.

Over 20 + professional dnn modules for News Article, Store, Video Gallery, Photo Gallery, Ultra Flash Player,YouTube Video, Image Slide show, Skin Chameleon and much more from DnnModule.com
 
New Post
3/19/2014 12:43 PM
 
you can implement the IUpgradeable interface in your module and use that - see http://www.dnnsoftware.com/wiki/page/...

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
3/19/2014 2:57 PM
 

Are there any more recent articles and/or examples on implementing IUpgradable?

The Code Project article link at the link you posted is from 2009 and from a much older version of DNN.

 
New Post
3/19/2014 7:19 PM
 

Sure, there's load's in platform code (taxonomy, journal, htmleditorprovider, htmleditor etc.) - grab a source download from http://www.dnnsoftware.com/community/... 

Here's a simple example from DNN Platform\Modules\HTML\Components\HtmlTextController.cs

public class HtmlTextController : ModuleSearchBase, IPortable, IUpgradeable

...removed various content

        public string UpgradeModule(string Version)

        {

            switch (Version)

            {

                case "05.01.02":

                    //remove the Code SubDirectory

                    Config.RemoveCodeSubDirectory("HTML");

                    //Once the web.config entry is done we can safely remove the HTML folder

                    var arrPaths = new string[1];

                    arrPaths[0] = "App_Code\\HTML\\";

                    FileSystemUtils.DeleteFiles(arrPaths);

                    break;

                case "06.00.00":

                    DesktopModuleInfo desktopModule = DesktopModuleController.GetDesktopModuleByModuleName("DNN_HTML", Null.NullInteger);

                    desktopModule.Category = "Common";

                    DesktopModuleController.SaveDesktopModule(desktopModule, false, false);

                    break;

                case "06.02.00":

                    AddNotificationTypes();

                    break;

            }

           return string.Empty;

        }

If you look into DNN Platform\Modules\HTML\dnn_HTML.dnn you'll see the module definition businessControllerClass mode referencing the class above, and declaring that it supports Upgradeable i.e.

  <component type="Module">

          <desktopModule>

            <moduleName>DNN_HTML</moduleName>

            <foldername>HTML</foldername>

            <shareable>Supported</shareable>

            <businessControllerClass>DotNetNuke.Modules.Html.HtmlTextController, DotNetNuke.Modules.Html</businessControllerClass>

            <supportedFeatures>

              <supportedFeature type="Portable" />

              <supportedFeature type="Searchable" />

              <supportedFeature type="Upgradeable" />

            </supportedFeatures>

            <moduleDefinitions>



Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsOther Extension...Other Extension...How to run code on extension installation/upgrade?How to run code on extension installation/upgrade?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out