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 ""; }
/// <summary> /// Application_Start /// Executes on the first web request into the portal application, /// when a new DLL is deployed, or when web.config is modified. /// </summary> /// <remarks> /// - global variable initialization /// </remarks> protected void Application_Start( object sender, EventArgs e ) { HttpServerUtility httpServerUtility = HttpContext.Current.Server; //global variable initialization Globals.ServerName = httpServerUtility.MachineName; if( HttpContext.Current.Request.ApplicationPath == "/" ) { Globals.ApplicationPath = ""; } else { Globals.ApplicationPath = HttpContext.Current.Request.ApplicationPath; } Globals.ApplicationMapPath = AppDomain.CurrentDomain.BaseDirectory.Substring( 0, AppDomain.CurrentDomain.BaseDirectory.Length - 1 ); Globals.ApplicationMapPath = Globals.ApplicationMapPath.Replace( "/", "\\" ); Globals.HostPath = Globals.ApplicationPath + "/Portals/_default/"; Globals.HostMapPath = httpServerUtility.MapPath( Globals.HostPath ); Globals.AssemblyPath = Globals.ApplicationMapPath + "\\bin\\dotnetnuke.dll"; //Check whether the current App Version is the same as the DB Version CheckVersion(); //Cache Mapped Directory(s) CacheMappedDirectory(); //log APPLICATION_START event LogStart(); //Start Scheduler StartScheduler(); //Process any messages in the EventQueue for the Application_Start event EventQueueController oEventController = new EventQueueController(); oEventController.ProcessMessages( "Application_Start" ); }
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(); } }