public static void ExportPublishmentSystemToSiteTemplate(PublishmentSystemInfo publishmentSystemInfo, string siteTemplateDir)
        {
            var exportObject = new ExportObject(publishmentSystemInfo.PublishmentSystemId);

            var siteTemplatePath = PathUtility.GetSiteTemplatesPath(siteTemplateDir);

            //导出模板
            var templateFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileTemplate);

            exportObject.ExportTemplates(templateFilePath);
            //导出辅助表及样式
            var tableDirectoryPath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.Table);

            exportObject.ExportTablesAndStyles(tableDirectoryPath);
            //导出下拉菜单
            var menuDisplayFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileMenuDisplay);

            exportObject.ExportMenuDisplay(menuDisplayFilePath);
            //导出模板标签样式
            var tagStyleFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileTagStyle);

            exportObject.ExportTagStyle(tagStyleFilePath);
            //导出广告
            var adFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileAd);

            exportObject.ExportAd(adFilePath);
            //导出采集规则
            var gatherRuleFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileGatherRule);

            exportObject.ExportGatherRule(gatherRuleFilePath);
            //导出提交表单
            var inputDirectoryPath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.Input);

            exportObject.ExportInput(inputDirectoryPath);
            //导出站点属性以及站点属性表单
            var configurationFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileConfiguration);

            exportObject.ExportConfiguration(configurationFilePath);
            //导出SEO
            var seoFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileSeo);

            exportObject.ExportSeo(seoFilePath);
            //导出自定义模板语言
            var stlTagFilePath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileStlTag);

            exportObject.ExportStlTag(stlTagFilePath);
            //导出关联字段
            var relatedFieldDirectoryPath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.RelatedField);

            exportObject.ExportRelatedField(relatedFieldDirectoryPath);
            //导出内容模型(自定义添加的)
            var contentModelDirectoryPath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, DirectoryUtils.SiteTemplates.FileContentModel);

            exportObject.ExportContentModel(contentModelDirectoryPath);
        }
Example #2
0
        public static void BackupSite(int publishmentSystemId, string filePath)
        {
            var exportObject          = new ExportObject(publishmentSystemId);
            var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);

            var siteTemplateDir  = PathUtils.GetFileNameWithoutExtension(filePath);
            var siteTemplatePath = PathUtils.Combine(DirectoryUtils.GetDirectoryPath(filePath), siteTemplateDir);

            DirectoryUtils.DeleteDirectoryIfExists(siteTemplatePath);
            FileUtils.DeleteFileIfExists(filePath);
            var metadataPath = PathUtility.GetSiteTemplateMetadataPath(siteTemplatePath, string.Empty);

            exportObject.ExportFilesToSite(siteTemplatePath, true, new ArrayList(), true);

            var siteContentDirectoryPath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.SiteContent);

            exportObject.ExportSiteContent(siteContentDirectoryPath, true, true, new List <int>());

            var templateFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileTemplate);

            exportObject.ExportTemplates(templateFilePath);
            var tableDirectoryPath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.Table);

            exportObject.ExportTablesAndStyles(tableDirectoryPath);
            var menuDisplayFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileMenuDisplay);

            exportObject.ExportMenuDisplay(menuDisplayFilePath);
            var tagStyleFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileTagStyle);

            exportObject.ExportTagStyle(tagStyleFilePath);
            var adFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileAd);

            exportObject.ExportAd(adFilePath);
            var gatherRuleFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileGatherRule);

            exportObject.ExportGatherRule(gatherRuleFilePath);
            var inputDirectoryPath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.Input);

            exportObject.ExportInput(inputDirectoryPath);
            var configurationFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileConfiguration);

            exportObject.ExportConfiguration(configurationFilePath);
            var contentModelFilePath = PathUtils.Combine(metadataPath, DirectoryUtils.SiteTemplates.FileContentModel);

            exportObject.ExportContentModel(contentModelFilePath);
            exportObject.ExportMetadata(publishmentSystemInfo.PublishmentSystemName, publishmentSystemInfo.PublishmentSystemUrl, string.Empty, string.Empty, metadataPath);

            ZipUtils.PackFiles(filePath, siteTemplatePath);
            DirectoryUtils.DeleteDirectoryIfExists(siteTemplatePath);
        }