private static void Bootstrapper_Bootstrapped(object sender, EventArgs e) { Startup.InitializeHelperFields(); ImageOptimizationTask.RemoveScheduledTasks(); var disableImageOptimizationAppSetting = System.Configuration.ConfigurationManager.AppSettings[ImageOptimizationConstants.DisableImageOptimizationAppSettingKey]; bool disableImageOptimization; if (!(bool.TryParse(disableImageOptimizationAppSetting, out disableImageOptimization) && disableImageOptimization)) { IList <IInstallableFileProcessor> imageOptimizationProcessors = new List <IInstallableFileProcessor>() { new KrakenImageOptimizationProcessor(), new TinifyImageOptimizationProcessor() }; IList <IInstallableFileProcessor> imageOptimizationProcessorsToRegister = new List <IInstallableFileProcessor>(); foreach (var imageOptimizationProcessor in imageOptimizationProcessors) { if (!ImageOptimizationProcessorsHelper.IsImageOptimizationProcessorRegistered(imageOptimizationProcessor)) { imageOptimizationProcessorsToRegister.Add(imageOptimizationProcessor); } } if (imageOptimizationProcessorsToRegister.Any()) { ImageOptimizationProcessorsHelper.RegisterImageOptimizationProcessors(imageOptimizationProcessorsToRegister); } Startup.hassImageOptimizationProcessorEnabled = ImageOptimizationProcessorsHelper.ValidateImageOptimizationProcessorsConfigurations(); Res.RegisterResource <ImageOptimizationResources>(); Config.RegisterSection <ImageOptimizationConfig>(); Startup.RegisterCrontabTasks(); } }
private static void RegisterCrontabTasks() { ImageOptimizationTask.RemoveScheduledTasks(); SystemManager.CrontabTasksToRun.Add(ImageOptimizationTask.GetTaskName(), ImageOptimizationTask.NewInstance); }