示例#1
0
文件: Initializer.cs 项目: lyfb/cms-1
        /// <summary>
        /// </summary>
        /// <param name="app"></param>
        public static void UserCmsInitializer(this IApplicationBuilder app)
        {
            app.UseCmsMiddleware(); // 添加cms拦截器
            // app.UseCmsRoutes();          // 注册路由

            //Cms.OnInit += CmsEventRegister.Init;
            // 初始化资源
            SiteResourceInit.Init();
            Cms.ConfigCache(new MemoryCacheWrapper());
            Cms.Init(BootFlag.Normal, null);
            // 加载插件
            //WebCtx.Current.Plugin.Connect();


            //设置可写权限
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");

            //注册定时任务
            CronJob.Initialize();
        }
示例#2
0
        public static void Init()
        {
            AspNetInitializer.Init();
#if DEBUG
            Cms.OfficialEnvironment = false;
#endif
            // 初始化资源
            SiteResourceInit.Init();
            Cms.ConfigCache(new AspNetCacheWrapper());
            //Cms.OnInit += CmsEventRegister.Init;
            Cms.Init(BootFlag.Normal, null);
            //注册路由;
            Routes.MapRoutes(RouteTable.Routes);
            // 加载插件
            //WebCtx.Current.Plugin.Connect();

            //RouteDebug.RouteDebugger.RewriteRoutesForTesting(routes);

            //加载自定义插件
            //Cms.Plugins.Extends.LoadFromAssembly(typeof(sp.datapicker.CollectionExtend).Assembly);

            //注册定时任务
            // CmsTask.Init();


            //设置可写权限
            Cms.Utility.SetDirCanWrite("bin");
            Cms.Utility.SetDirCanWrite("templates/");
            Cms.Utility.SetDirCanWrite(CmsVariables.RESOURCE_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.FRAMEWORK_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.PLUGIN_PATH);
            Cms.Utility.SetDirCanWrite(CmsVariables.TEMP_PATH + "update");
            Cms.Utility.SetDirHidden("config");

            //注册定时任务
            CronJob.Initialize();
        }