WiX Update fixes.
This commit is contained in:
parent
5ab109df9a
commit
473fd3c3ef
8 changed files with 500 additions and 56 deletions
|
@ -331,11 +331,14 @@
|
|||
<Publish Dialog="PrereqCheckDlg" Control="Cancel" Event="SpawnDialog" Value="CancelDlg">1</Publish>
|
||||
<!--CustomizeDlg-->
|
||||
<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="PrereqCheckDlg" Order="3">1</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SWebDlg" Order="12">&ServerFeature=3</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ESWebDlg" Order="11">&EnterpriseServerFeature=3</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="PWebDlg" Order="10">&PortalFeature=3</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="DatabaseConnectionDlg" Order="9">&SchedulerServiceFeature=3</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="CustomVerifyReadyDlg" Order="8">&WDPortalFeature=3</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ServerPasswordDlg" Order="15"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ServerAdminPasswordDlg" Order="14"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ESUrlDlg" Order="13"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SWebDlg" Order="12"><![CDATA[&ServerFeature=3 AND COMPFOUND_SERVER=0]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ESWebDlg" Order="11"><![CDATA[&EnterpriseServerFeature=3 AND COMPFOUND_ESERVER=0]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="PWebDlg" Order="10"><![CDATA[&PortalFeature=3 AND COMPFOUND_PORTAL=0]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="DatabaseConnectionDlg" Order="9"><![CDATA[&SchedulerServiceFeature=3 AND COMPFOUND_SCHEDULER=0]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="CustomVerifyReadyDlg" Order="8"><![CDATA[&WDPortalFeature=3 AND COMPFOUND_WDPORTAL=0]]></Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="CustomVerifyReadyDlg" Order="7">1</Publish>
|
||||
<Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="CA_RecapListUI" Order="1">1</Publish>
|
||||
<!--SWebDlg-->
|
||||
|
@ -357,7 +360,10 @@
|
|||
<Publish Dialog="SUserAccountDlg" Control="SelectUserButton" Property="PI_SERVER_LOGIN" Value="[DSOP_UPN]" Order="3"><![CDATA[DSOP_UPN <> ""]]></Publish>
|
||||
<Publish Dialog="SUserAccountDlg" Control="SelectUserButton" Property="PI_SERVER_LOGIN" Value="[DSOP_NAME]" Order="3"><![CDATA[DSOP_NAME <> "" AND DSOP_UPN = ""]]></Publish>
|
||||
<!--ServerPasswordDlg-->
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Back" Event="NewDialog" Value="SUserAccountDlg">1</Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="2"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Back" Event="NewDialog" Value="SUserAccountDlg" Order="1">1</Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Next" Event="NewDialog" Value="ServerAdminPasswordDlg" Order="9"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3 AND VALIDATE_OK = 1]]></Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Next" Event="NewDialog" Value="ESUrlDlg" Order="8"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3 AND VALIDATE_OK = "1"]]></Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Next" Event="NewDialog" Value="ESWebDlg" Order="7">&EnterpriseServerFeature=3 AND VALIDATE_OK = "1"</Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Next" Event="NewDialog" Value="PWebDlg" Order="6">&PortalFeature=3 AND VALIDATE_OK = "1"</Publish>
|
||||
<Publish Dialog="ServerPasswordDlg" Control="Next" Event="NewDialog" Value="DatabaseConnectionDlg" Order="5">&SchedulerServiceFeature=3 AND VALIDATE_OK = "1"</Publish>
|
||||
|
@ -389,7 +395,11 @@
|
|||
<Publish Dialog="ESUserAccountDlg" Control="SelectUserButton" Property="PI_ESERVER_LOGIN" Value="[DSOP_UPN]" Order="3"><![CDATA[DSOP_UPN <> ""]]></Publish>
|
||||
<Publish Dialog="ESUserAccountDlg" Control="SelectUserButton" Property="PI_ESERVER_LOGIN" Value="[DSOP_NAME]" Order="3"><![CDATA[DSOP_NAME <> "" AND DSOP_UPN = ""]]></Publish>
|
||||
<!--ServerAdminPasswordDlg-->
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Back" Event="NewDialog" Value="ESUserAccountDlg">1</Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Back" Event="NewDialog" Value="ServerPasswordDlg" Order="3"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="2"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3]]></Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Back" Event="NewDialog" Value="ESUserAccountDlg" Order="1">1</Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Next" Event="NewDialog" Value="ESUrlDlg" Order="5"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3 AND VALIDATE_OK = "1"]]></Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Next" Event="NewDialog" Value="CustomVerifyReadyDlg" Order="4"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3 AND VALIDATE_OK = "1"]]></Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Next" Event="NewDialog" Value="DatabaseConnectionDlg" Order="3"><![CDATA[(&EnterpriseServerFeature=3 OR &SchedulerServiceFeature=3) AND VALIDATE_OK="1"]]></Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Next" Event="SpawnDialog" Value="ValidateDlg" Order="2">VALIDATE_OK="0"</Publish>
|
||||
<Publish Dialog="ServerAdminPasswordDlg" Control="Next" Event="DoAction" Value="CA_ServerAdminValidateUI" Order="1">1</Publish>
|
||||
|
@ -437,16 +447,22 @@
|
|||
<Publish Dialog="PUserAccountDlg" Control="SelectUserButton" Property="PI_PORTAL_LOGIN" Value="[DSOP_UPN]" Order="3"><![CDATA[DSOP_UPN <> ""]]></Publish>
|
||||
<Publish Dialog="PUserAccountDlg" Control="SelectUserButton" Property="PI_PORTAL_LOGIN" Value="[DSOP_NAME]" Order="3"><![CDATA[DSOP_NAME <> "" AND DSOP_UPN = ""]]></Publish>
|
||||
<!--ESUrlDlg-->
|
||||
<Publish Dialog="ESUrlDlg" Control="Back" Event="NewDialog" Value="PUserAccountDlg">1</Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Back" Event="NewDialog" Value="ServerAdminPasswordDlg" Order="4"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3]]></Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Back" Event="NewDialog" Value="ServerPasswordDlg" Order="3"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="2"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3]]></Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Back" Event="NewDialog" Value="PUserAccountDlg" Order="1">1</Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Next" Event="NewDialog" Value="DatabaseConnectionDlg" Order="2"><![CDATA[&SchedulerServiceFeature=3]]></Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Next" Event="NewDialog" Value="CustomVerifyReadyDlg" Order="1">1</Publish>
|
||||
<Publish Dialog="ESUrlDlg" Control="Cancel" Event="SpawnDialog" Value="CancelDlg">1</Publish>
|
||||
<!--CustomVerifyReadyDlg-->
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseConnectionDlg" Order="16"><![CDATA[&SchedulerServiceFeature=3 AND NOT(&EnterpriseServerFeature=3)]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ESUrlDlg" Order="15"><![CDATA[&PortalFeature=3 AND NOT(&EnterpriseServerFeature=3)]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="PUserAccountDlg" Order="14"><![CDATA[&PortalFeature=3 AND &EnterpriseServerFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseConnectionDlg" Order="13"><![CDATA[&EnterpriseServerFeature=3 AND &PortalFeature<>3]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServerPasswordDlg" Order="12"><![CDATA[&ServerFeature=3 AND &EnterpriseServerFeature<>3 AND &PortalFeature<>3]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ESUrlDlg" Order="19"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServerPasswordDlg" Order="18"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServerAdminPasswordDlg" Order="17"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseConnectionDlg" Order="16"><![CDATA[&SchedulerServiceFeature=3 AND NOT(&EnterpriseServerFeature=3) AND COMPFOUND_SCHEDULER=0]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ESUrlDlg" Order="15"><![CDATA[&PortalFeature=3 AND NOT(&EnterpriseServerFeature=3) AND COMPFOUND_PORTAL=0]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="PUserAccountDlg" Order="14"><![CDATA[&PortalFeature=3 AND &EnterpriseServerFeature=3 AND COMPFOUND_PORTAL=0]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseConnectionDlg" Order="13"><![CDATA[&EnterpriseServerFeature=3 AND &PortalFeature<>3 AND COMPFOUND_ESERVER=0]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="ServerPasswordDlg" Order="12"><![CDATA[&ServerFeature=3 AND &EnterpriseServerFeature<>3 AND &PortalFeature<>3 AND COMPFOUND_SERVER=0]]></Publish>
|
||||
<Publish Dialog="CustomVerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">1</Publish>
|
||||
<!--FinishDlg-->
|
||||
<Publish Dialog="FinishDlg" Control="Next" Event="NewDialog" Value="FinishDlg">1</Publish>
|
||||
|
@ -543,6 +559,12 @@
|
|||
<Property Id="WSP_BASE" Secure="yes">
|
||||
<RegistrySearch Id='Search_WSP_BASE' Root='HKLM' Key='SOFTWARE\[ProductName]' Name='Base' Type='raw' />
|
||||
</Property>
|
||||
<!--Was found an existing installation (configuration) on local pc. COMPFOUND stands for COMPonent FOUND.-->
|
||||
<Property Id="COMPFOUND_SERVER" Secure="yes" Value="0" />
|
||||
<Property Id="COMPFOUND_ESERVER" Secure="yes" Value="0" />
|
||||
<Property Id="COMPFOUND_PORTAL" Secure="yes" Value="0" />
|
||||
<Property Id="COMPFOUND_WDPORTAL" Secure="yes" Value="0" />
|
||||
<Property Id="COMPFOUND_SCHEDULER" Secure="yes" Value="0" />
|
||||
<!--CustomActions.-->
|
||||
<!-- <CustomAction Id='AlreadyUpdated' Error='Product has already been updated to $(var.VERSION) or newer.' />
|
||||
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' /> -->
|
||||
|
@ -589,6 +611,13 @@
|
|||
<CustomAction Id="CA_OnEServerRemove" BinaryKey="Assembly_CA" DllEntry="OnEServerRemove" Impersonate="no" Execute="deferred" HideTarget="no" />
|
||||
<CustomAction Id="CA_PropertyOnPortalRemove" Property="CA_OnPortalRemove" Value="InstallerFolder=[WEBSITEPANELDIR];ComponentCode=portal;BaseDirectory=[WEBSITEPANELDIR];MODE_UP=[WIX_UPGRADE_DETECTED];MODE_RUP=[UPGRADINGPRODUCTCODE]" />
|
||||
<CustomAction Id="CA_OnPortalRemove" BinaryKey="Assembly_CA" DllEntry="OnPortalRemove" Impersonate="no" Execute="deferred" HideTarget="no" />
|
||||
<!--Maintenance mode.-->
|
||||
<CustomAction Id="CA_PropertyMaintenanceServer" Property="CA_MaintenanceServer" Value="InstallerFolder=[WEBSITEPANELDIR];ComponentCode=server;BaseDirectory=[WEBSITEPANELDIR];ServerPassword=[SERVER_ACCESS_PASSWORD]" />
|
||||
<CustomAction Id="CA_MaintenanceServer" BinaryKey="Assembly_CA" DllEntry="MaintenanceServer" Impersonate="no" Execute="deferred" HideTarget="no" />
|
||||
<CustomAction Id="CA_PropertyMaintenanceEServer" Property="CA_MaintenanceEServer" Value="InstallerFolder=[WEBSITEPANELDIR];ComponentCode=enterpriseserver;BaseDirectory=[WEBSITEPANELDIR];ServerAdminPassword=[SERVERADMIN_PASSWORD];" />
|
||||
<CustomAction Id="CA_MaintenanceEServer" BinaryKey="Assembly_CA" DllEntry="MaintenanceEServer" Impersonate="no" Execute="deferred" HideTarget="no" />
|
||||
<CustomAction Id="CA_PropertyMaintenancePortal" Property="CA_MaintenancePortal" Value="InstallerFolder=[WEBSITEPANELDIR];ComponentCode=portal;BaseDirectory=[WEBSITEPANELDIR];EnterpriseServerUrl=[PI_ESERVER_URL]" />
|
||||
<CustomAction Id="CA_MaintenancePortal" BinaryKey="Assembly_CA" DllEntry="MaintenancePortal" Impersonate="no" Execute="deferred" HideTarget="no" />
|
||||
<!---->
|
||||
<SetProperty Id="WEBSITEPANELDIR" After="AppSearch" Value="[WSP_BASE]">WSP_BASE</SetProperty>
|
||||
<CustomAction Id="CA_PreFillSettings" BinaryKey="Assembly_CA" DllEntry="PreFillSettings" />
|
||||
|
@ -612,6 +641,14 @@
|
|||
<Custom Action="CA_OnEServerRemove" Before="StopServices"><![CDATA[(&EnterpriseServerFeature=2) AND (!EnterpriseServerFeature=3)]]></Custom>
|
||||
<Custom Action="CA_PropertyOnPortalRemove" After="InstallInitialize"><![CDATA[(&PortalFeature=2) AND (!PortalFeature=3)]]></Custom>
|
||||
<Custom Action="CA_OnPortalRemove" After="CA_PropertyOnPortalRemove"><![CDATA[(&PortalFeature=2) AND (!PortalFeature=3)]]></Custom>
|
||||
<!--Maintenance.-->
|
||||
<Custom Action="CA_PropertyMaintenanceServer" After="InstallInitialize"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Custom>
|
||||
<Custom Action="CA_MaintenanceServer" After="CA_PropertyMaintenanceServer"><![CDATA[&ServerFeature=-1 AND !ServerFeature=3]]></Custom>
|
||||
<Custom Action="CA_PropertyMaintenanceEServer" After="InstallInitialize"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3]]></Custom>
|
||||
<Custom Action="CA_MaintenanceEServer" After="CA_PropertyMaintenanceEServer"><![CDATA[&EnterpriseServerFeature=-1 AND !EnterpriseServerFeature=3]]></Custom>
|
||||
<Custom Action="CA_PropertyMaintenancePortal" After="InstallInitialize"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3]]></Custom>
|
||||
<Custom Action="CA_MaintenancePortal" After="CA_PropertyMaintenancePortal"><![CDATA[&PortalFeature=-1 AND !PortalFeature=3]]></Custom>
|
||||
<!---->
|
||||
<Custom Action="CA_PreFillSettings" After="SetWEBSITEPANELDIR">1</Custom>
|
||||
</InstallExecuteSequence>
|
||||
<InstallUISequence>
|
||||
|
@ -634,7 +671,7 @@
|
|||
<DirectoryRef Id="INSTALLENTERPRISESERVERFOLDER">
|
||||
<Component Id="InstallDatabaseSql" Guid="{81FB6008-A445-464F-8A0E-2EE076027FF3}">
|
||||
<CreateFolder />
|
||||
<Condition>(NOT Installed OR NOT WIX_UPGRADE_DETECTED) AND NOT(DB_AUTH = "Windows Authentication")</Condition>
|
||||
<Condition>(NOT Installed AND NOT WIX_UPGRADE_DETECTED) AND NOT(DB_AUTH = "Windows Authentication")</Condition>
|
||||
<util:User Id="SqlUser" Name="[DB_LOGIN]" Password="[DB_PASSWORD]" CreateUser="no" />
|
||||
<sql:SqlDatabase Id="SqlDatabaseInstallSql" ConfirmOverwrite="yes" ContinueOnError="no" CreateOnInstall="yes" CreateOnReinstall="no" CreateOnUninstall="no"
|
||||
DropOnInstall="no" DropOnReinstall="no" DropOnUninstall="no"
|
||||
|
@ -658,7 +695,7 @@
|
|||
</Component>
|
||||
<Component Id="InstallDatabaseWin" Guid="{C50FC58C-3EF3-452D-BA9B-C9513B4D941A}">
|
||||
<CreateFolder />
|
||||
<Condition>(NOT Installed OR NOT WIX_UPGRADE_DETECTED) AND (DB_AUTH = "Windows Authentication")</Condition>
|
||||
<Condition>(NOT Installed AND NOT WIX_UPGRADE_DETECTED) AND (DB_AUTH = "Windows Authentication")</Condition>
|
||||
<sql:SqlDatabase Id="SqlDatabaseInstallWin" ConfirmOverwrite="yes" ContinueOnError="no" CreateOnInstall="yes" CreateOnReinstall="no" CreateOnUninstall="no"
|
||||
DropOnInstall="no" DropOnReinstall="no" DropOnUninstall="no"
|
||||
Server="[DB_SERVER]"
|
||||
|
|
|
@ -88,7 +88,8 @@ namespace WebsitePanel.Setup
|
|||
SwitchServer2AspNet40,
|
||||
SwitchEntServer2AspNet40,
|
||||
SwitchWebPortal2AspNet40,
|
||||
ConfigureSecureSessionModuleInWebConfig
|
||||
ConfigureSecureSessionModuleInWebConfig,
|
||||
RestoreConfig
|
||||
}
|
||||
|
||||
public class InstallAction
|
||||
|
|
|
@ -322,12 +322,30 @@ namespace WebsitePanel.Setup
|
|||
case WindowsVersion.WindowsServer2008:
|
||||
ret = "Windows Server 2008";
|
||||
break;
|
||||
case WindowsVersion.WindowsServer2008R2:
|
||||
ret = "Windows Server 2008 R2";
|
||||
break;
|
||||
case WindowsVersion.WindowsServer2012:
|
||||
ret = "Windows Server 2012";
|
||||
break;
|
||||
case WindowsVersion.WindowsServer2012R2:
|
||||
ret = "Windows Server 2012 R2";
|
||||
break;
|
||||
case WindowsVersion.WindowsVista:
|
||||
ret = "Windows Vista";
|
||||
break;
|
||||
case WindowsVersion.WindowsXP:
|
||||
ret = "Windows XP";
|
||||
break;
|
||||
case WindowsVersion.Windows7:
|
||||
ret = "Windows 7";
|
||||
break;
|
||||
case WindowsVersion.Windows8:
|
||||
ret = "Windows 8";
|
||||
break;
|
||||
default:
|
||||
ret = "Windows";
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,9 @@ namespace WebsitePanel.Setup.Internal
|
|||
case SetupActions.Uninstall:
|
||||
Uninstall();
|
||||
break;
|
||||
case SetupActions.Setup:
|
||||
Maintenance();
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -101,6 +104,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
|
||||
protected abstract void Install();
|
||||
protected abstract void Uninstall();
|
||||
protected abstract void Maintenance();
|
||||
|
||||
/// <summary>
|
||||
/// LoadSetupVariablesFromParameters.
|
||||
|
@ -393,6 +397,9 @@ namespace WebsitePanel.Setup.Internal
|
|||
case ActionTypes.ConfigureSecureSessionModuleInWebConfig:
|
||||
ConfigureSecureSessionModuleInWebConfig();
|
||||
break;
|
||||
case ActionTypes.RestoreConfig:
|
||||
RestoreXmlConfigs(Execute.SetupVariables);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -402,7 +409,6 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual List<InstallAction> GetActions(string ComponentID)
|
||||
{
|
||||
return new List<InstallAction>();
|
||||
|
@ -843,7 +849,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
return;
|
||||
}
|
||||
// Load web.config
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
|
||||
// add node:
|
||||
|
@ -993,7 +999,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
return;
|
||||
}
|
||||
// Load web.config
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
// do Windows 2008 platform-specific changes
|
||||
bool iis7 = (Context.IISVersion.Major >= 7);
|
||||
|
@ -1229,7 +1235,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
private string GetConnectionString(string webConfigPath)
|
||||
{
|
||||
string ret = null;
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
//connection string
|
||||
string xPath = "configuration/connectionStrings/add[@name=\"EnterpriseServer\"]";
|
||||
|
@ -1244,7 +1250,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
private string GetCryptoKey(string webConfigPath)
|
||||
{
|
||||
string ret = null;
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
//crypto key
|
||||
string xPath = "configuration/appSettings/add[@key=\"WebsitePanel.CryptoKey\"]";
|
||||
|
@ -1258,7 +1264,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
|
||||
private bool IsEncryptionEnabled(string webConfigPath)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
//encryption enabled
|
||||
string xPath = "configuration/appSettings/add[@key=\"WebsitePanel.EncryptionEnabled\"]";
|
||||
|
@ -2316,7 +2322,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
|
||||
Log.WriteStart("Updating config.xml file");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
|
||||
XmlNode serversNode = doc.SelectSingleNode("//myLittleAdmin/sqlservers");
|
||||
|
@ -2429,7 +2435,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
return;
|
||||
}
|
||||
// Load web.config
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
|
||||
// Tighten WSE security on local machine
|
||||
|
@ -2513,7 +2519,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
|
||||
Log.WriteStart("Loading portal settings");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
|
||||
string xPath = "configuration/connectionStrings/add[@name=\"SiteSqlServer\"]";
|
||||
|
@ -2605,7 +2611,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
|
||||
Log.WriteStart("Updating site settings");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
|
||||
XmlElement urlNode = doc.SelectSingleNode("SiteSettings/EnterpriseServer") as XmlElement;
|
||||
|
@ -3178,7 +3184,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
|
||||
Log.WriteStart("Updating configuration file (server password)");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
|
||||
XmlElement passwordNode = doc.SelectSingleNode("//websitepanel.server/security/password") as XmlElement;
|
||||
|
@ -3221,7 +3227,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
|
||||
Log.WriteStart("Updating configuration file (service settings)");
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
|
||||
XmlElement ipNode = doc.SelectSingleNode("//configuration/appSettings/add[@key='WebsitePanel.HostIP']") as XmlElement;
|
||||
|
@ -3881,7 +3887,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
return;
|
||||
}
|
||||
// Load web.config
|
||||
XmlDocument doc = new XmlDocument();
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(webConfigPath);
|
||||
|
||||
// replace existing node:
|
||||
|
@ -3915,8 +3921,63 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
#endregion
|
||||
#endregion
|
||||
private void RestoreXmlConfigs(SetupVariables Ctx)
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.WriteStart("RestoreXmlConfigs");
|
||||
var Backup = BackupRestore.Find(Ctx.InstallerFolder, "WebsitePanel", Ctx.ComponentName);
|
||||
switch(Ctx.ComponentCode)
|
||||
{
|
||||
case "server":
|
||||
{
|
||||
Backup.XmlFiles.Add("Web.config");
|
||||
}
|
||||
break;
|
||||
case "enterpriseserver":
|
||||
{
|
||||
Backup.XmlFiles.Add("Web.config");
|
||||
}
|
||||
break;
|
||||
case "portal":
|
||||
{
|
||||
Backup.XmlFiles.Add("Web.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\Countries.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\CountryStates.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\Ecommerce_Modules.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\Ecommerce_Pages.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\ESModule_ControlsHierarchy.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\ModulesData.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\SiteSettings.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\SupportedLocales.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\SupportedThemes.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\WebsitePanel_Modules.config");
|
||||
Backup.XmlFiles.Add(@"App_Data\WebsitePanel_Pages.config");
|
||||
}
|
||||
break;
|
||||
}
|
||||
var MainCfg = Path.Combine(Ctx.InstallerFolder, BackupRestore.MainConfig);
|
||||
var XCfg = new XmlDocument();
|
||||
XCfg.Load(MainCfg);
|
||||
if (XCfg.SelectSingleNode("//components").ChildNodes.Count == 0)
|
||||
{
|
||||
Log.WriteInfo("Restoring main config...");
|
||||
XmlDocumentMerge.Process(Backup.BackupMainConfigFile, MainCfg);
|
||||
Context.ComponentId = WiXSetup.GetComponentID(Ctx);
|
||||
AppConfig.LoadConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = MainCfg });
|
||||
AppConfig.LoadComponentSettings(Ctx);
|
||||
}
|
||||
Log.WriteInfo(string.Format("Restoring xml config for component - {0}.", Ctx.ComponentFullName));
|
||||
Backup.Restore();
|
||||
Log.WriteEnd("RestoreXmlConfigs");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteError("RestoreXmlConfigs", ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class UninstallScript : SetupScript // UninstallPage
|
||||
{
|
||||
public UninstallScript(SetupVariables SessionVariables):base(SessionVariables)
|
||||
|
@ -4117,12 +4178,22 @@ namespace WebsitePanel.Setup.Internal
|
|||
protected override List<InstallAction> GetActions(string ComponentID)
|
||||
{
|
||||
var Scenario = base.GetActions(ComponentID);
|
||||
var Act = new InstallAction(ActionTypes.UpdateConfig);
|
||||
Act.Description = "Updating system configuration...";
|
||||
Scenario.Add(Act);
|
||||
Act = new InstallAction(ActionTypes.StartApplicationPool);
|
||||
Act.Description = "Starting IIS Application Pool...";
|
||||
Scenario.Add(Act);
|
||||
Scenario.Add(new InstallAction(ActionTypes.RestoreConfig) { SetupVariables = Context, Description = "Restoring xml configuration files..." });
|
||||
Scenario.Add(new InstallAction(ActionTypes.UpdateConfig) { Description = "Updating system configuration..." });
|
||||
Scenario.Add(new InstallAction(ActionTypes.StartApplicationPool) { Description = "Starting IIS Application Pool..." });
|
||||
return Scenario;
|
||||
}
|
||||
}
|
||||
public class MaintenanceScript: ExpressScript
|
||||
{
|
||||
public MaintenanceScript(SetupVariables SessionVariables):base(SessionVariables)
|
||||
{
|
||||
Context.SetupAction = SetupActions.Setup;
|
||||
}
|
||||
protected override List<InstallAction> GetActions(string ComponentID)
|
||||
{
|
||||
var Scenario = base.GetActions(ComponentID);
|
||||
Scenario.Add(new InstallAction(ActionTypes.UpdateConfig) { Description = "Updating system configuration..." });
|
||||
return Scenario;
|
||||
}
|
||||
}
|
||||
|
@ -4170,6 +4241,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
else if (ModeExtension == ModeExtension.Restore)
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
Context.UpdateVersion = Context.Release;
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
new RestoreScript(Context).Run();
|
||||
}
|
||||
|
@ -4194,12 +4266,19 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
Script.Run();
|
||||
}
|
||||
protected override void Maintenance()
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
SetupScript Script = new MaintenanceScript(Context);
|
||||
Script.Actions.Add(new InstallAction(ActionTypes.UpdateServerPassword) { Description = "Updating server password..." });
|
||||
Script.Run();
|
||||
}
|
||||
}
|
||||
|
||||
public class EServerSetup : WiXSetup
|
||||
{
|
||||
public EServerSetup(SetupVariables Ctx)
|
||||
: base(Ctx)
|
||||
public EServerSetup(SetupVariables Ctx, ModeExtension Ext)
|
||||
: base(Ctx, Ext)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -4210,7 +4289,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
SetupVars.SetupAction = Action;
|
||||
SetupVars.IISVersion = Global.IISVersion;
|
||||
AppConfig.LoadConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = GetFullConfigPath(SetupVars) });
|
||||
return new EServerSetup(SetupVars);
|
||||
return new EServerSetup(SetupVars, GetModeExtension(Ctx));
|
||||
}
|
||||
protected override void Install()
|
||||
{
|
||||
|
@ -4240,6 +4319,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
else if (ModeExtension == ModeExtension.Restore)
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
Context.UpdateVersion = Context.Release;
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
new RestoreScript(Context).Run();
|
||||
}
|
||||
|
@ -4264,12 +4344,19 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
Script.Run();
|
||||
}
|
||||
protected override void Maintenance()
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
SetupScript Script = new MaintenanceScript(Context);
|
||||
Script.Actions.Add(new InstallAction(ActionTypes.UpdateServerAdminPassword) { Description = "Updating serveradmin password..." });
|
||||
Script.Run();
|
||||
}
|
||||
}
|
||||
|
||||
public class PortalSetup : WiXSetup
|
||||
{
|
||||
public PortalSetup(SetupVariables Ctx)
|
||||
: base(Ctx)
|
||||
public PortalSetup(SetupVariables Ctx, ModeExtension Ext)
|
||||
: base(Ctx, Ext)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -4280,7 +4367,7 @@ namespace WebsitePanel.Setup.Internal
|
|||
SetupVars.SetupAction = Action;
|
||||
SetupVars.IISVersion = Global.IISVersion;
|
||||
AppConfig.LoadConfiguration(new ExeConfigurationFileMap { ExeConfigFilename = GetFullConfigPath(SetupVars) });
|
||||
return new PortalSetup(SetupVars);
|
||||
return new PortalSetup(SetupVars, GetModeExtension(Ctx));
|
||||
}
|
||||
protected override void Install()
|
||||
{
|
||||
|
@ -4306,17 +4393,11 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
if (WiXThrow)
|
||||
InstallFailed();
|
||||
|
||||
else if (ModeExtension == ModeExtension.Restore)
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
new RestoreScript(Context).Run();
|
||||
}
|
||||
}
|
||||
else if (ModeExtension == ModeExtension.Restore)
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
Context.UpdateVersion = Context.Release;
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
new RestoreScript(Context).Run();
|
||||
}
|
||||
|
@ -4348,8 +4429,15 @@ namespace WebsitePanel.Setup.Internal
|
|||
}
|
||||
Script.Run();
|
||||
}
|
||||
protected override void Maintenance()
|
||||
{
|
||||
Context.ComponentId = GetComponentID(Context);
|
||||
AppConfig.LoadComponentSettings(Context);
|
||||
SetupScript Script = new MaintenanceScript(Context);
|
||||
Script.Actions.Add(new InstallAction(ActionTypes.UpdateEnterpriseServerUrl) { Description = "Updating site settings..." });
|
||||
Script.Run();
|
||||
}
|
||||
}
|
||||
|
||||
#region WiXActionManagers
|
||||
public class WiXServerActionManager : BaseActionManager
|
||||
{
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using Ionic.Zip;
|
||||
|
||||
namespace WebsitePanel.Setup.Internal
|
||||
{
|
||||
class BackupRestore
|
||||
{
|
||||
struct DirectoryTag
|
||||
{
|
||||
public string Name;
|
||||
public DateTime Date;
|
||||
public Version Version;
|
||||
}
|
||||
public const string MainConfig = "WebsitePanel.config";
|
||||
const string BackupDirectory = "Backup";
|
||||
const string ConfigDirectory = "Config";
|
||||
const string AppZip = @"App\app.zip";
|
||||
const string DateFormat = "yyyy-MM-dd";
|
||||
public BackupRestore()
|
||||
{
|
||||
XmlFiles = new List<string>();
|
||||
}
|
||||
public static BackupRestore Find(string Root, string Product, string Id)
|
||||
{
|
||||
var Result = default(BackupRestore);
|
||||
var Dir = Path.Combine(Root, BackupDirectory);
|
||||
var FullId = GetFullId(Product, Id);
|
||||
if (Directory.Exists(Dir))
|
||||
{
|
||||
var DirList = new List<DirectoryTag>();
|
||||
foreach (var DateItem in Directory.GetDirectories(Dir))
|
||||
{
|
||||
DateTime date;
|
||||
var DateName = new DirectoryInfo(DateItem).Name;
|
||||
if (DateTime.TryParseExact(DateName, DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out date))
|
||||
{
|
||||
foreach (var VersionItem in Directory.GetDirectories(DateItem))
|
||||
{
|
||||
var VersionName = new DirectoryInfo(VersionItem).Name;
|
||||
if (VersionName.StartsWith(FullId, StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
Version BckpVersion;
|
||||
var StrVersion = VersionName.Substring(FullId.Length);
|
||||
if (Version.TryParse(StrVersion, out BckpVersion))
|
||||
{
|
||||
DirList.Add(new DirectoryTag { Name = VersionItem, Date = date, Version = BckpVersion });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var ByVersion = from i in DirList where i.Version == (from v in DirList select v.Version).Max() select i;
|
||||
var ByDate = from i in ByVersion where i.Date == (from v in ByVersion select v.Date).Max() select i;
|
||||
var SrcTag = ByDate.First();
|
||||
Result = new BackupRestore { Id = Id, Root = GetComponentRoot(SrcTag, Id), BackupFile = Path.Combine(SrcTag.Name, AppZip), BackupMainConfigFile = GetMainConfig(SrcTag) };
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
private static string GetComponentRoot(DirectoryTag DirTag, string Id)
|
||||
{
|
||||
var Cfg = GetMainConfig(DirTag);
|
||||
if (string.IsNullOrWhiteSpace(Cfg))
|
||||
throw new Exception("Broken backup. Main config file not found.");
|
||||
var XCfg = new XmlDocument();
|
||||
XCfg.Load(Cfg);
|
||||
var Component = XCfg.SelectSingleNode(string.Format("//component[.//add/@key='ComponentName' and .//add/@value='{0}']", Id));
|
||||
var InstallFolder = Component.SelectSingleNode(".//add[@key='InstallFolder']");
|
||||
return InstallFolder.Attributes["value"].Value;
|
||||
}
|
||||
private static string GetMainConfig(DirectoryTag DirTag)
|
||||
{
|
||||
return Path.Combine(DirTag.Name, ConfigDirectory, MainConfig);
|
||||
}
|
||||
private static string GetFullId(string Product, string Id)
|
||||
{
|
||||
return string.Format("{0} {1}", Product, Id);
|
||||
}
|
||||
public virtual void Restore()
|
||||
{
|
||||
using (var Bckp = new ZipFile(BackupFile))
|
||||
{
|
||||
foreach (var Xml in XmlFiles)
|
||||
{
|
||||
var SrcEntry = from Entry in Bckp.Entries where NormalizePath(Entry.FileName.ToLowerInvariant(), "/") == Xml.ToLowerInvariant() select Entry;
|
||||
if (SrcEntry != null)
|
||||
{
|
||||
if (SrcEntry.LongCount() > 1)
|
||||
throw new Exception(string.Format("Too many backup entries - {0}.", Xml));
|
||||
var FileEntry = SrcEntry.FirstOrDefault();
|
||||
if (FileEntry != null)
|
||||
{
|
||||
using (var InMem = new MemoryStream())
|
||||
{
|
||||
FileEntry.Extract(InMem);
|
||||
InMem.Seek(0, SeekOrigin.Begin);
|
||||
using (var OutFile = new FileStream(Path.Combine(Root, Xml), FileMode.Open, FileAccess.ReadWrite))
|
||||
{
|
||||
XmlDocumentMerge.Process(InMem, OutFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private string NormalizePath(string FilePath, string In)
|
||||
{
|
||||
return Path.Combine(FilePath.Split(new string[] { In }, StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
public string Id { get; set; } // Component full name.
|
||||
public string Comment { get; set; }
|
||||
public string BackupFile { get; set; } // Should be zip archive.
|
||||
public string BackupMainConfigFile { get; set; }
|
||||
public IList<string> XmlFiles { get; set; } // Xml files (configs) to merge and update.
|
||||
public string Root { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace WebsitePanel.Setup.Internal
|
||||
{
|
||||
public static class XmlDocumentMerge
|
||||
{
|
||||
const string SuccessFormat = "Success: {0}.";
|
||||
const string ErrorFormat = "Error: {0}.";
|
||||
const string MergeCompleted = "XmlDocumentMerge completed";
|
||||
static XmlDocumentMerge()
|
||||
{
|
||||
KeyAttributes = new List<string> { "name", "id", "key" };
|
||||
}
|
||||
public static List<string> KeyAttributes { get; set; }
|
||||
public static string Process(string Src, string Dst, string SaveTo = "")
|
||||
{
|
||||
var Result = string.Empty;
|
||||
if (!File.Exists(Src))
|
||||
Result = string.Format(ErrorFormat, string.Format("source document [{0}] does not exists", Src));
|
||||
else if (!File.Exists(Dst))
|
||||
Result = string.Format(ErrorFormat, string.Format("destination document [{0}] does not exists", Dst));
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var InStream = new FileStream(Src, FileMode.Open, FileAccess.Read);
|
||||
var OutStream = new FileStream(Dst, FileMode.Open, FileAccess.ReadWrite);
|
||||
Result = Process(InStream,
|
||||
OutStream,
|
||||
SaveTo);
|
||||
InStream.Close();
|
||||
OutStream.Flush();
|
||||
OutStream.Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result = string.Format(ErrorFormat, ex.ToString());
|
||||
}
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
public static string Process(Stream InSrc, Stream OutDst, string SaveTo = "")
|
||||
{
|
||||
var Result = string.Format(SuccessFormat, MergeCompleted);
|
||||
try
|
||||
{
|
||||
var SrcDoc = new XmlDocument();
|
||||
SrcDoc.Load(InSrc);
|
||||
var DstDoc = new XmlDocument();
|
||||
DstDoc.Load(OutDst);
|
||||
var DstNavi = DstDoc.CreateNavigator();
|
||||
var DstIterator = DstNavi.SelectChildren(XPathNodeType.All);
|
||||
while (DstIterator.MoveNext())
|
||||
Merge(DstIterator.Current.Clone(), SrcDoc, string.Empty);
|
||||
if (string.IsNullOrWhiteSpace(SaveTo))
|
||||
{
|
||||
OutDst.SetLength(0);
|
||||
DstDoc.Save(OutDst);
|
||||
}
|
||||
else
|
||||
DstDoc.Save(SaveTo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Result = string.Format(ErrorFormat, ex.ToString());
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
private static string NodePath(string Parent, string Current)
|
||||
{
|
||||
var Result = string.Empty;
|
||||
if (!string.IsNullOrWhiteSpace(Parent) && !string.IsNullOrWhiteSpace(Current))
|
||||
Result = string.Format("{0}/{1}", Parent, Current);
|
||||
else if (!string.IsNullOrWhiteSpace(Parent))
|
||||
Result = Parent;
|
||||
else if (!string.IsNullOrWhiteSpace(Current))
|
||||
Result = Current;
|
||||
return Result;
|
||||
}
|
||||
private static string NodeView(XPathNavigator Navi)
|
||||
{
|
||||
foreach (var Attr in KeyAttributes)
|
||||
{
|
||||
var Value = Navi.GetAttribute(Attr, string.Empty);
|
||||
if (!string.IsNullOrWhiteSpace(Value))
|
||||
return string.Format("{0}[@{1}='{2}']", Navi.Name, Attr, Value);
|
||||
}
|
||||
return Navi.Name;
|
||||
}
|
||||
private static void Merge(XPathNavigator DstNavi, XmlDocument SrcDoc, string Parent)
|
||||
{
|
||||
if (DstNavi.NodeType == XPathNodeType.Element)
|
||||
{
|
||||
var SrcElem = SrcDoc.SelectSingleNode(NodePath(Parent, NodeView(DstNavi)));
|
||||
if (SrcElem != null)
|
||||
{
|
||||
if (DstNavi.MoveToFirstAttribute())
|
||||
{
|
||||
do
|
||||
{
|
||||
var SrcElemAttr = SrcElem.Attributes[DstNavi.LocalName];
|
||||
if (SrcElemAttr != null)
|
||||
DstNavi.SetValue(SrcElemAttr.Value);
|
||||
}
|
||||
while (DstNavi.MoveToNextAttribute());
|
||||
DstNavi.MoveToParent();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (DstNavi.NodeType == XPathNodeType.Text)
|
||||
{
|
||||
var SrcElem = SrcDoc.SelectSingleNode(NodePath(Parent, NodeView(DstNavi)));
|
||||
if (SrcElem != null)
|
||||
DstNavi.SetValue(SrcElem.InnerText);
|
||||
}
|
||||
var Here = NodeView(DstNavi);
|
||||
if (DstNavi.MoveToFirstChild())
|
||||
{
|
||||
do
|
||||
{
|
||||
Merge(DstNavi, SrcDoc, NodePath(Parent, Here));
|
||||
}
|
||||
while (DstNavi.MoveToNext());
|
||||
DstNavi.MoveToParent();
|
||||
}
|
||||
else if (DstNavi.NodeType == XPathNodeType.Element)
|
||||
{
|
||||
var SrcElem = SrcDoc.SelectSingleNode(NodePath(Parent, Here));
|
||||
if (SrcElem != null && !string.IsNullOrWhiteSpace(SrcElem.InnerXml))
|
||||
foreach (XmlNode Child in SrcElem.ChildNodes)
|
||||
DstNavi.AppendChild(Child.CloneNode(true).CreateNavigator());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -144,6 +144,8 @@
|
|||
<Compile Include="EnterpriseServer10.cs" />
|
||||
<Compile Include="EnterpriseServer20.cs" />
|
||||
<Compile Include="Internal\Adapter.cs" />
|
||||
<Compile Include="Internal\BackupRestore.cs" />
|
||||
<Compile Include="Internal\XmlDocumentMerge.cs" />
|
||||
<Compile Include="Portal10.cs" />
|
||||
<Compile Include="Portal20.cs" />
|
||||
<Compile Include="Server10.cs" />
|
||||
|
|
|
@ -54,6 +54,33 @@ namespace WebsitePanel.WIXInstaller
|
|||
|
||||
#region CustomActions
|
||||
[CustomAction]
|
||||
public static ActionResult MaintenanceServer(Session session)
|
||||
{
|
||||
var Result = ActionResult.Success;
|
||||
Log.WriteStart("MaintenanceServer");
|
||||
Result = ProcessInstall(session, WiXInstallType.MaintenanceServer);
|
||||
Log.WriteEnd("MaintenanceServer");
|
||||
return Result;
|
||||
}
|
||||
[CustomAction]
|
||||
public static ActionResult MaintenanceEServer(Session session)
|
||||
{
|
||||
var Result = ActionResult.Success;
|
||||
Log.WriteStart("MaintenanceEServer");
|
||||
Result = ProcessInstall(session, WiXInstallType.MaintenanceEnterpriseServer);
|
||||
Log.WriteEnd("MaintenanceEServer");
|
||||
return Result;
|
||||
}
|
||||
[CustomAction]
|
||||
public static ActionResult MaintenancePortal(Session session)
|
||||
{
|
||||
var Result = ActionResult.Success;
|
||||
Log.WriteStart("MaintenancePortal");
|
||||
Result = ProcessInstall(session, WiXInstallType.MaintenancePortal);
|
||||
Log.WriteEnd("MaintenancePortal");
|
||||
return Result;
|
||||
}
|
||||
[CustomAction]
|
||||
public static ActionResult PreFillSettings(Session session)
|
||||
{
|
||||
PopUpDebugger();
|
||||
|
@ -733,18 +760,27 @@ namespace WebsitePanel.WIXInstaller
|
|||
case WiXInstallType.RemoveServer:
|
||||
Install = ServerSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
|
||||
break;
|
||||
case WiXInstallType.MaintenanceServer:
|
||||
Install = ServerSetup.Create(Ctx.CustomActionData, SetupActions.Setup);
|
||||
break;
|
||||
case WiXInstallType.InstallEnterpriseServer:
|
||||
Install = EServerSetup.Create(Ctx.CustomActionData, SetupActions.Install);
|
||||
break;
|
||||
case WiXInstallType.RemoveEnterpriseServer:
|
||||
Install = EServerSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
|
||||
break;
|
||||
case WiXInstallType.MaintenanceEnterpriseServer:
|
||||
Install = EServerSetup.Create(Ctx.CustomActionData, SetupActions.Setup);
|
||||
break;
|
||||
case WiXInstallType.InstallPortal:
|
||||
Install = PortalSetup.Create(Ctx.CustomActionData, SetupActions.Install);
|
||||
break;
|
||||
case WiXInstallType.RemovePortal:
|
||||
Install = PortalSetup.Create(Ctx.CustomActionData, SetupActions.Uninstall);
|
||||
break;
|
||||
case WiXInstallType.MaintenancePortal:
|
||||
Install = PortalSetup.Create(Ctx.CustomActionData, SetupActions.Setup);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -796,7 +832,8 @@ namespace WebsitePanel.WIXInstaller
|
|||
RemoveServer,
|
||||
RemoveEnterpriseServer,
|
||||
RemovePortal,
|
||||
RemoveUpdate,
|
||||
RestoreUpdate
|
||||
MaintenanceServer,
|
||||
MaintenanceEnterpriseServer,
|
||||
MaintenancePortal
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue