Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ You need to download and extract the [PackageInstaller zip file](https://github.
performance.
--ssl Accept the self registered ssl certificate

--mm, --mergeMode
The merge mode to be used while installing regular Sitecore package. The mode accepted are overwrite, merge, clear, append, skip. Which corresponds to Sitecore's Overwrite, merge/merge, merge/clear, merge/append, merge/skip modes. If mergeMode not specified overwrite is used. Any value other then specification throws Error.
## Usage Examples
# Install a sitecore package
Sidewalk.SC.PackageInstaller.Client.exe -sitecoreUrl "http://sc72rev140228" -sitecoreDeployFolder "C:\inetpub\wwwroot\sc72rev140228\Website" -packagePath "C:\temp\TestPkg.zip" -connector "sitecore"
Expand Down
Binary file modified Sidewalk.PackageInstaller.zip
Binary file not shown.
20 changes: 19 additions & 1 deletion Sidewalk.SC.PackageInstaller.Client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ static void Main(string[] args)
bool publishChildrenItems = false;
bool removeConnector = false;
bool acceptSsl = false;
string mergeMode = null;

// Options declaration
OptionSet options = new OptionSet()
Expand Down Expand Up @@ -137,6 +138,10 @@ static void Main(string[] args)
"ssl", "Accept the self registered ssl certificate",
v => acceptSsl = v != null
},
{
"mm|mergeMode=", "Define the merge mode to install the package",
v => mergeMode = v
}
};

#endregion
Expand Down Expand Up @@ -278,7 +283,20 @@ static void Main(string[] args)
else if (connectorMode.Equals("sitecore",
StringComparison.InvariantCultureIgnoreCase))
{
service.InstallPackage(packagePath);
if (mergeMode != null)
{
if (!mergeMode.ToLower().Equals("merge") &&
!mergeMode.ToLower().Equals("clear") &&
!mergeMode.ToLower().Equals("append") &&
!mergeMode.ToLower().Equals("skip") &&
!mergeMode.ToLower().Equals("overwrite"))
{
log.Error("Merge mode wrong. Accepted modes=> merge, clear, append, overwrite, skip. Default mode overwrite(if mergeMode not provided)");
Environment.Exit(106);
}
mergeMode = mergeMode.ToLower();
}
service.InstallPackage(packagePath, mergeMode);
}
log.Debug("Update package installed successfully.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Sidewalk.SC.PackageInstaller.Client.ServiceReference {


/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.81.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="SitecorePackageInstallerSoap", Namespace="http://sitecoreblog.blogspot.be/")]
Expand All @@ -39,7 +39,7 @@ public partial class SitecorePackageInstaller : System.Web.Services.Protocols.So

/// <remarks/>
public SitecorePackageInstaller() {
this.Url = Properties.Settings.Default.Sidewalk_SC_PackageInstaller_Client_ServiceReference_SitecorePackageInstaller;
this.Url = global::Sidewalk.SC.PackageInstaller.Client.Properties.Settings.Default.Sidewalk_SC_PackageInstaller_Client_ServiceReference_SitecorePackageInstaller;
if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
this.UseDefaultCredentials = true;
this.useDefaultCredentialsSetExplicitly = false;
Expand Down Expand Up @@ -84,23 +84,25 @@ public SitecorePackageInstaller() {

/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://sitecoreblog.blogspot.be/InstallPackage", RequestNamespace="http://sitecoreblog.blogspot.be/", ResponseNamespace="http://sitecoreblog.blogspot.be/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void InstallPackage(string path) {
public void InstallPackage(string path, string mergeMode) {
this.Invoke("InstallPackage", new object[] {
path});
path,
mergeMode});
}

/// <remarks/>
public void InstallPackageAsync(string path) {
this.InstallPackageAsync(path, null);
public void InstallPackageAsync(string path, string mergeMode) {
this.InstallPackageAsync(path, mergeMode, null);
}

/// <remarks/>
public void InstallPackageAsync(string path, object userState) {
public void InstallPackageAsync(string path, string mergeMode, object userState) {
if ((this.InstallPackageOperationCompleted == null)) {
this.InstallPackageOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallPackageOperationCompleted);
}
this.InvokeAsync("InstallPackage", new object[] {
path}, this.InstallPackageOperationCompleted, userState);
path,
mergeMode}, this.InstallPackageOperationCompleted, userState);
}

private void OnInstallPackageOperationCompleted(object arg) {
Expand Down Expand Up @@ -199,7 +201,7 @@ private bool IsLocalFileSystemWebService(string url) {
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.81.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://sitecoreblog.blogspot.be/")]
public enum PublishMode {
Expand All @@ -221,15 +223,15 @@ public enum PublishMode {
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.81.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
public delegate void InstallPackageCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.81.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
public delegate void InstallTdsPackageCompletedEventHandler(object sender, InstallTdsPackageCompletedEventArgs e);

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.81.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class InstallTdsPackageCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
Expand All @@ -251,7 +253,7 @@ public string Result {
}

/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.6.81.0")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.7.3056.0")]
public delegate void PublishCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://sitecoreblog.blogspot.be/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://sitecoreblog.blogspot.be/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://sitecoreblog.blogspot.be/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://sitecoreblog.blogspot.be/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://sitecoreblog.blogspot.be/">
<s:element name="InstallPackage">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="path" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="mergeMode" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Expand Down
24 changes: 21 additions & 3 deletions Sidewalk.SC.PackageInstaller.Service/SitecorePackageInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SitecorePackageInstaller : System.Web.Services.WebService
/// </summary>
/// <param name="path">A path to a package that is reachable by the web server</param>
[WebMethod(Description = "Installs a Sitecore Package.")]
public void InstallPackage(string path)
public void InstallPackage(string path, string mergeMode)
{
// Use default logger
ILog log = LogManager.GetLogger("root");
Expand All @@ -51,8 +51,26 @@ public void InstallPackage(string path)
using (new SyncOperationContext())
{
Sitecore.Install.Framework.IProcessingContext context = new Sitecore.Install.Framework.SimpleProcessingContext(); //
Sitecore.Install.Items.IItemInstallerEvents events =
new Sitecore.Install.Items.DefaultItemInstallerEvents(new Sitecore.Install.Utils.BehaviourOptions(Sitecore.Install.Utils.InstallMode.Overwrite, Sitecore.Install.Utils.MergeMode.Undefined));
Sitecore.Install.Items.IItemInstallerEvents events = null;
if (mergeMode == null || mergeMode.Equals("overwrite"))
{
events = new Sitecore.Install.Items.DefaultItemInstallerEvents(new Sitecore.Install.Utils.BehaviourOptions(Sitecore.Install.Utils.InstallMode.Overwrite, Sitecore.Install.Utils.MergeMode.Undefined));
}
else if (mergeMode.Equals("merge"))
{
events = new Sitecore.Install.Items.DefaultItemInstallerEvents(new Sitecore.Install.Utils.BehaviourOptions(Sitecore.Install.Utils.InstallMode.Merge, Sitecore.Install.Utils.MergeMode.Merge));
}
else if (mergeMode.Equals("clear"))
{
events = new Sitecore.Install.Items.DefaultItemInstallerEvents(new Sitecore.Install.Utils.BehaviourOptions(Sitecore.Install.Utils.InstallMode.Merge, Sitecore.Install.Utils.MergeMode.Clear));
}
else if (mergeMode.Equals("append"))
{
events = new Sitecore.Install.Items.DefaultItemInstallerEvents(new Sitecore.Install.Utils.BehaviourOptions(Sitecore.Install.Utils.InstallMode.Merge, Sitecore.Install.Utils.MergeMode.Append));
} else if (mergeMode.Equals("skip"))
{
events = new Sitecore.Install.Items.DefaultItemInstallerEvents(new Sitecore.Install.Utils.BehaviourOptions(Sitecore.Install.Utils.InstallMode.Skip, Sitecore.Install.Utils.MergeMode.Undefined));
}
context.AddAspect(events);
Sitecore.Install.Files.IFileInstallerEvents events1 = new Sitecore.Install.Files.DefaultFileInstallerEvents(true);
context.AddAspect(events1);
Expand Down