Ejemplo n.º 1
0
        public static void RunSchedule(HttpRequest request)
        {
            DnnLog.MethodEntry();

            //First check if we are upgrading/installing
            if (request.Url.LocalPath.ToLower().EndsWith("install.aspx") ||
                request.Url.LocalPath.ToLower().EndsWith("upgradewizard.aspx") ||
                request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx"))
            {
                return;
            }
            try
            {
                if (SchedulingProvider.SchedulerMode == SchedulerMode.REQUEST_METHOD && SchedulingProvider.ReadyForPoll)
                {
                    DnnLog.Trace("Running Schedule " + (SchedulingProvider.SchedulerMode));
                    SchedulingProvider scheduler = SchedulingProvider.Instance();
                    var requestScheduleThread    = new Thread(scheduler.ExecuteTasks);
                    requestScheduleThread.IsBackground = true;
                    requestScheduleThread.Start();
                    SchedulingProvider.ScheduleLastPolled = DateTime.Now;
                }
            }
            catch (Exception exc)
            {
                Exceptions.LogException(exc);
            }
        }
Ejemplo n.º 2
0
        private void LoadProperties()
        {
            DnnLog.MethodEntry();

            var fileManager = FileManager.Instance as FileManager;
            var fileContent = fileManager.GetFileContent(this);

            if (fileContent == null)
            {
                //If can't get file content then just exit the function, so it will load again next time.
                return;
            }

            if (!fileContent.CanSeek)
            {
                fileContent = fileManager.GetSeekableStream(fileContent);
            }

            if (fileManager.IsImageFile(this))
            {
                Image image = null;

                try
                {
                    image = fileManager.GetImageFromStream(fileContent);

                    _width  = image.Width;
                    _height = image.Height;
                }
                catch
                {
                    _width      = 0;
                    _height     = 0;
                    ContentType = "application/octet-stream";
                }
                finally
                {
                    if (image != null)
                    {
                        image.Dispose();
                    }
                    fileContent.Position = 0;
                }

                _sha1Hash = fileManager.GetHash(fileContent);
            }
            else
            {
                _width = _height = 0;

                _sha1Hash = fileManager.GetHash(fileContent);
            }


            fileManager.UpdateFile(this);
        }
Ejemplo n.º 3
0
        private static string InitializeApp(HttpApplication app)
        {
            DnnLog.MethodEntry();
            HttpRequest request  = app.Request;
            string      redirect = Null.NullString;

            DnnLog.Trace("Request " + request.Url.LocalPath);

            //Don't process some of the AppStart methods if we are installing
            if (!request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx") &&
                !request.Url.LocalPath.ToLower().EndsWith("upgradewizard.aspx") &&
                !request.Url.LocalPath.ToLower().EndsWith("install.aspx"))
            {
                //Check whether the current App Version is the same as the DB Version
                redirect = CheckVersion(app);
                if (string.IsNullOrEmpty(redirect))
                {
                    DnnLog.Info("Application Initializing");

                    //Cache Mapped Directory(s)
                    CacheMappedDirectory();
                    //Set globals
                    Globals.IISAppName             = request.ServerVariables["APPL_MD_PATH"];
                    Globals.OperatingSystemVersion = Environment.OSVersion.Version;
                    Globals.NETFrameworkVersion    = GetNETFrameworkVersion();
                    Globals.DatabaseEngineVersion  = GetDatabaseEngineVersion();
                    //Try and Upgrade to Current Framewok
                    Upgrade.TryUpgradeNETFramework();

                    //Start Scheduler
                    StartScheduler();
                    //Log Application Start
                    LogStart();
                    //Process any messages in the EventQueue for the Application_Start event
                    EventQueueController.ProcessMessages("Application_Start");

                    ServicesRoutingManager.RegisterServiceRoutes();

                    //Set Flag so we can determine the first Page Request after Application Start
                    app.Context.Items.Add("FirstRequest", true);

                    //Log Server information
                    ServerController.UpdateServerActivity(new ServerInfo());
                    DnnLog.Info("Application Initialized");
                }
            }
            else
            {
                //NET Framework version is neeed by Upgrade
                Globals.NETFrameworkVersion = GetNETFrameworkVersion();
            }
            return(redirect);
        }
Ejemplo n.º 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// StartScheduler starts the Scheduler
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [cnurse]    1/27/2005   Moved back to App_Start from Scheduling Module
        /// </history>
        /// -----------------------------------------------------------------------------
        public static void StartScheduler()
        {
            DnnLog.MethodEntry();

            //instantiate APPLICATION_START scheduled jobs
            if (SchedulingProvider.SchedulerMode == SchedulerMode.TIMER_METHOD)
            {
                DnnLog.Trace("Running Schedule " + (SchedulingProvider.SchedulerMode));
                SchedulingProvider scheduler = SchedulingProvider.Instance();
                scheduler.RunEventSchedule(EventName.APPLICATION_START);
                var newThread = new Thread(SchedulingProvider.Instance().Start);
                newThread.IsBackground = true;
                newThread.Start();
            }
        }
Ejemplo n.º 5
0
        private void Application_End(object Sender, EventArgs E)
        {
            DnnLog.MethodEntry();
            DnnLog.Info("Application Ending");
            Initialize.LogEnd();
            Initialize.StopScheduler();

            DnnLog.Trace("Dumping all Application Errors");
            if (HttpContext.Current != null)
            {
                foreach (Exception exc in HttpContext.Current.AllErrors)
                {
                    DnnLog.Fatal(exc);
                }
            }
            DnnLog.Trace("End Dumping all Application Errors");
            DnnLog.Info("Application Ended");
        }