Exemplo n.º 1
0
        protected override string UpgradeModule(DesktopModuleInfo ModuleInfo)
        {
            if (!String.IsNullOrEmpty(ModuleInfo.BusinessControllerClass))
            {
                string UpgradeVersionsList = "";

                if (UpgradeVersions.Count > 0)
                {
                    foreach (string Version in UpgradeVersions)
                    {
                        UpgradeVersionsList = UpgradeVersionsList + Version + ",";
                        DeleteFiles(ModuleInfo.FolderName, Version);
                    }
                    if (UpgradeVersionsList.EndsWith(","))
                    {
                        UpgradeVersionsList = UpgradeVersionsList.Remove(UpgradeVersionsList.Length - 1, 1);
                    }
                }
                else
                {
                    UpgradeVersionsList = ModuleInfo.Version;
                }

                //this cannot be done directly at this time because
                //the module may not be loaded into the app domain yet
                //So send an EventMessage that will process the update
                //after the App recycles
                EventMessage oAppStartMessage = new EventMessage();
                oAppStartMessage.ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke";
                oAppStartMessage.Attributes.Add("ProcessCommand", "UpgradeModule");
                oAppStartMessage.Attributes.Add("BusinessControllerClass", ModuleInfo.BusinessControllerClass);
                oAppStartMessage.Attributes.Add("DesktopModuleId", ModuleInfo.DesktopModuleID.ToString());
                oAppStartMessage.Attributes.Add("UpgradeVersionsList", UpgradeVersionsList);
                oAppStartMessage.Priority = MessagePriority.High;
                oAppStartMessage.SentDate = DateTime.Now;
                //make it expire as soon as it's processed
                oAppStartMessage.ExpirationDate = DateTime.Now.AddYears(-1);
                //send it
                EventQueueController oEventQueueController = new EventQueueController();
                oEventQueueController.SendMessage(oAppStartMessage, "Application_Start");                
            }
            //TODO: Need to implement a feedback loop to display the results of the upgrade.

            return "";
        }
 private void UpdateModuleInterfaces(string BusinessControllerClass)
 {
     //Check to see if Interfaces (SupportedFeatures) Need to be Updated
     if (BusinessControllerClass != "")
     {
         //this cannot be done directly at this time because 
         //the module may not be loaded into the app domain yet
         //So send an EventMessage that will process the update 
         //after the App recycles
         EventMessage oAppStartMessage = new EventMessage();
         oAppStartMessage.ProcessorType = "DotNetNuke.Entities.Modules.EventMessageProcessor, DotNetNuke";
         oAppStartMessage.Attributes.Add("ProcessCommand", "UpdateSupportedFeatures");
         oAppStartMessage.Attributes.Add("BusinessControllerClass", BusinessControllerClass);
         oAppStartMessage.Attributes.Add("DesktopModuleId", DesktopModuleId.ToString());
         oAppStartMessage.Priority = MessagePriority.High;
         oAppStartMessage.SentDate = DateTime.Now;
         oAppStartMessage.Body = "";
         //make it expire as soon as it's processed
         oAppStartMessage.ExpirationDate = DateTime.Now.AddYears(-1);
         //send it
         EventQueueController oEventQueueController = new EventQueueController();
         oEventQueueController.SendMessage(oAppStartMessage, "Application_Start");
         //force an app restart
         Config.Touch();
     }
 }