<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using CprBroker.Installers;

namespace PersonMasterInstallers
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult TestDatabaseConnection(Session session)
        {
            return DatabaseCustomAction.TestConnectionString(session);
        }

        [CustomAction]
        public static ActionResult DeployDatabase(Session session)
        {
            DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.FromSession(session);
            string sql = Properties.Resources.crebas;
            sql = sql.Replace("<pm-cryptpassword>", databaseSetupInfo.EncryptionKey);
            sql = sql.Replace("<pm-namespace>", databaseSetupInfo.Domain);

            return DatabaseCustomAction.DeployDatabase(session, sql, new KeyValuePair<string, string>[0]);
        }

        [CustomAction]
        public static ActionResult RollbackDatabase(Session session)
        {
            return DatabaseCustomAction.RemoveDatabase(session, false);
        }

        [CustomAction]
        public static ActionResult RemoveDatabase(Session session)
        {
            return DatabaseCustomAction.RemoveDatabase(session, true);
        }

        [CustomAction]
        public static ActionResult PopulateWebSites(Session session)
        {
            return ActionResult.Success;
        }

        [CustomAction]
        public static ActionResult CreateWebsite(Session session)
        {
            DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.FromSession(session);
            Dictionary<string, string> connectionStrings = new Dictionary<string, string>();
            connectionStrings["CPRMapperDB"] = databaseSetupInfo.CreateConnectionString(false, true);
            WebInstallationOptions options = new WebInstallationOptions()
            {
                ConnectionStrings = connectionStrings,
                ConfigSectionGroupEncryptionOptions = new ConfigSectionGroupEncryptionOptions[0],
                EncryptConnectionStrings = false,
                InitializeFlatFileLogging = false,
                FrameworkVersion = new Version("4.0")
            };
            return WebsiteCustomAction.DeployWebsite(session, options);
        }

        [CustomAction]
        public static ActionResult RollbackWebsite(Session session)
        {
            return WebsiteCustomAction.RollbackWebsite(session);
        }

        [CustomAction]
        public static ActionResult RemoveWebSite(Session session)
        {
            return WebsiteCustomAction.RemoveWebSite(session);
        }

    }
}
<commit_msg>Custom action to validate web properties in PersonMaster<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
using CprBroker.Installers;

namespace PersonMasterInstallers
{
    public class CustomActions
    {
        [CustomAction]
        public static ActionResult TestDatabaseConnection(Session session)
        {
            return DatabaseCustomAction.TestConnectionString(session);
        }

        [CustomAction]
        public static ActionResult DeployDatabase(Session session)
        {
            DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.FromSession(session);
            string sql = Properties.Resources.crebas;
            sql = sql.Replace("<pm-cryptpassword>", databaseSetupInfo.EncryptionKey);
            sql = sql.Replace("<pm-namespace>", databaseSetupInfo.Domain);

            return DatabaseCustomAction.DeployDatabase(session, sql, new KeyValuePair<string, string>[0]);
        }

        [CustomAction]
        public static ActionResult RollbackDatabase(Session session)
        {
            return DatabaseCustomAction.RemoveDatabase(session, false);
        }

        [CustomAction]
        public static ActionResult RemoveDatabase(Session session)
        {
            return DatabaseCustomAction.RemoveDatabase(session, true);
        }

        [CustomAction]
        public static ActionResult PopulateWebSites(Session session)
        {
            return ActionResult.Success;
        }

        [CustomAction]
        public static ActionResult ValidateWebProperties(Session session)
        {
            return WebsiteCustomAction.ValidateWebProperties(session);
        }

        [CustomAction]
        public static ActionResult CreateWebsite(Session session)
        {
            DatabaseSetupInfo databaseSetupInfo = DatabaseSetupInfo.FromSession(session);
            Dictionary<string, string> connectionStrings = new Dictionary<string, string>();
            connectionStrings["CPRMapperDB"] = databaseSetupInfo.CreateConnectionString(false, true);
            WebInstallationOptions options = new WebInstallationOptions()
            {
                ConnectionStrings = connectionStrings,
                ConfigSectionGroupEncryptionOptions = new ConfigSectionGroupEncryptionOptions[0],
                EncryptConnectionStrings = false,
                InitializeFlatFileLogging = false,
                FrameworkVersion = new Version("4.0")
            };
            return WebsiteCustomAction.DeployWebsite(session, options);
        }

        [CustomAction]
        public static ActionResult RollbackWebsite(Session session)
        {
            return WebsiteCustomAction.RollbackWebsite(session);
        }

        [CustomAction]
        public static ActionResult RemoveWebSite(Session session)
        {
            return WebsiteCustomAction.RemoveWebSite(session);
        }

    }
}

{'fraction_non_alphanumeric': 0.06627946703108985, 'fraction_numerical': 0.0013665869490946361, 'mean_word_length': 2.3418949771689497, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4269728', 'n_tokens_mistral': 1319, 'n_tokens_neox': 1267, 'n_words': 271}