diff --git a/SitecorePackageDeployer.TDS/Hhogdev.SitecorePackageDeployer.TDS.scproj b/SitecorePackageDeployer.TDS/Hhogdev.SitecorePackageDeployer.TDS.scproj index d2c80e8..21c4f20 100644 --- a/SitecorePackageDeployer.TDS/Hhogdev.SitecorePackageDeployer.TDS.scproj +++ b/SitecorePackageDeployer.TDS/Hhogdev.SitecorePackageDeployer.TDS.scproj @@ -37,7 +37,7 @@ Charles Turano Hedgehog Development Installs packages using a folder - 1.6 + 1.8 ..\packages\SitecoreKernel.7.0.0.131127\lib diff --git a/SitecorePackageDeployer.Web/Properties/AssemblyInfo.cs b/SitecorePackageDeployer.Web/Properties/AssemblyInfo.cs index 96cb433..bdbc972 100644 --- a/SitecorePackageDeployer.Web/Properties/AssemblyInfo.cs +++ b/SitecorePackageDeployer.Web/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Hhogdev.SitecorePackageDeployer.Web")] -[assembly: AssemblyCopyright("Copyright © 2015")] +[assembly: AssemblyCopyright("Copyright © 2015, 2016, 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,5 +31,5 @@ // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")] diff --git a/SitecorePackageDeployer/Pipelines/Initialize/RunPostInstallSteps.cs b/SitecorePackageDeployer/Pipelines/Initialize/RunPostInstallSteps.cs index 7f62eaf..929d9f4 100644 --- a/SitecorePackageDeployer/Pipelines/Initialize/RunPostInstallSteps.cs +++ b/SitecorePackageDeployer/Pipelines/Initialize/RunPostInstallSteps.cs @@ -8,7 +8,9 @@ using Sitecore.Pipelines; using Sitecore.SecurityModel; using System; +using System.Diagnostics; using System.IO; +using System.Reflection; using System.Threading; using System.Xml.Serialization; @@ -30,6 +32,8 @@ private void LoadSettings() public void Process(PipelineArgs args) { + Log.Info("Sitecore package deployer starting. Version: " + FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location). FileVersion, this); + //Check to see if we can run post steps InstallPackage.InstallerState state = InstallPackage.GetInstallerState(); if (state == InstallPackage.InstallerState.InstallingPackage || state == InstallPackage.InstallerState.InstallingPostSteps) diff --git a/SitecorePackageDeployer/Properties/AssemblyInfo.cs b/SitecorePackageDeployer/Properties/AssemblyInfo.cs index 2b61977..c31ef79 100644 --- a/SitecorePackageDeployer/Properties/AssemblyInfo.cs +++ b/SitecorePackageDeployer/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.6.0.0")] -[assembly: AssemblyFileVersion("1.6.0.0")] +[assembly: AssemblyVersion("1.8.0.0")] +[assembly: AssemblyFileVersion("1.8.0.0")] diff --git a/SitecorePackageDeployer/Tasks/InstallPackage.cs b/SitecorePackageDeployer/Tasks/InstallPackage.cs index 9474abd..fb8ec97 100644 --- a/SitecorePackageDeployer/Tasks/InstallPackage.cs +++ b/SitecorePackageDeployer/Tasks/InstallPackage.cs @@ -43,7 +43,7 @@ internal enum InstallerState internal const string STARTUP_POST_STEP_PACKAGE_FILENAME = "StartPostStepPackage.xml"; internal const string SUCCESS = "Success"; internal const string FAIL = "Fail"; - internal const string INSTALLER_STATE_PROPERTY = "SPD_InstallerState"; + internal const string INSTALLER_STATE_PROPERTY = "SPD_InstallerState_"; static string sitecoreUpdatePath = Assembly.GetAssembly(typeof(PackageInstallationInfo)).Location; static Assembly sitecoreUpdateAssembly = Assembly.LoadFile(sitecoreUpdatePath); @@ -57,9 +57,6 @@ internal enum InstallerState //Determines if the config files should be updated bool _updateConfigurationFiles; - //Indicates that a package is being installed - - public static bool ShutdownDetected { get; set; } public InstallPackage() @@ -114,30 +111,38 @@ private void InstallPackages() return; } - //Block further package installs - SetInstallerState(InstallerState.InstallingPackage); - - using (new SecurityDisabler()) + //Prevent shutdown + using (new ShutdownGuard()) { - //Find pending packages. This loop may not complete if there were binary/config changes - foreach (string updatePackageFilename in Directory.GetFiles(_packageSource, "*.update", SearchOption.TopDirectoryOnly).OrderBy(f => f)) + //If Sitecore is shutting down, don't start the installer + if (ShutdownDetected) { - string updatePackageFilenameStripped = updatePackageFilename.Split('\\').Last(); - if (ShutdownDetected) - { - Log.Info("Install packages aborting due to shutdown", this); + Log.Info("Skipping Install because shutdown is pending", this); - if (GetInstallerState() != InstallerState.WaitingForPostSteps) - { - SetInstallerState(InstallerState.Ready); - } + return; + } - break; - } + //Block further package installs + SetInstallerState(InstallerState.InstallingPackage); - //Prevent shutdown - using (new ShutdownGuard()) + using (new SecurityDisabler()) + { + //Find pending packages. This loop may not complete if there were binary/config changes + foreach (string updatePackageFilename in Directory.GetFiles(_packageSource, "*.update", SearchOption.TopDirectoryOnly).OrderBy(f => f)) { + string updatePackageFilenameStripped = updatePackageFilename.Split('\\').Last(); + if (ShutdownDetected) + { + Log.Info("Install packages aborting due to shutdown", this); + + if (GetInstallerState() != InstallerState.WaitingForPostSteps) + { + SetInstallerState(InstallerState.Ready); + } + + break; + } + Log.Info(String.Format("Begin Installation: {0}", updatePackageFilenameStripped), this); string installationHistoryRoot = null; @@ -251,12 +256,12 @@ private void InstallPackages() } } } - } - if (!ShutdownDetected) - { - //Allow additional installs - SetInstallerState(InstallerState.Ready); + if (!ShutdownDetected) + { + //Allow additional installs + SetInstallerState(InstallerState.Ready); + } } } } @@ -266,7 +271,7 @@ internal static void SetInstallerState(InstallerState installState) Log.Info(string.Format("Setting installer state to {0}", installState), typeof(InstallPackage)); Database coreDb = Database.GetDatabase("core"); - coreDb.Properties.SetIntValue(INSTALLER_STATE_PROPERTY, (int)installState); + coreDb.Properties.SetIntValue(INSTALLER_STATE_PROPERTY + Environment.MachineName, (int)installState); } /// @@ -276,7 +281,7 @@ internal static void SetInstallerState(InstallerState installState) internal static InstallerState GetInstallerState() { Database coreDb = Database.GetDatabase("core"); - return (InstallerState)coreDb.Properties.GetIntValue(INSTALLER_STATE_PROPERTY, (int)InstallerState.Ready); + return (InstallerState)coreDb.Properties.GetIntValue(INSTALLER_STATE_PROPERTY + Environment.MachineName, (int)InstallerState.Ready); } ///