public void InstallPackage(string path) { bool hasPostAction; string historyPath; // Use default logger ILog log = LogManager.GetLogger("root"); XmlConfigurator.Configure((XmlElement)ConfigurationManager.GetSection("log4net")); using (new SecurityDisabler()) { DiffInstaller installer = new DiffInstaller(UpgradeAction.Upgrade); MetadataView view = UpdateHelper.LoadMetadata(path); //Get the package entries List <ContingencyEntry> entries = installer.InstallPackage(path, InstallMode.Install, log, out hasPostAction, out historyPath); installer.ExecutePostInstallationInstructions(path, historyPath, InstallMode.Install, view, log, ref entries); #if SITECORE_6X UpdateHelper.SaveInstallationMessages(entries, historyPath); #endif } }
protected override void ProcessRecord() { // Use default logger var log = LogManager.GetLogger("root"); XmlConfigurator.Configure((XmlElement)ConfigurationManager.GetSection("log4net")); if (ShouldProcess(Path, "Install update package")) { PerformInstallAction( () => { var installer = new DiffInstaller(UpgradeAction); var view = UpdateHelper.LoadMetadata(Path); bool hasPostAction; string historyPath; var entries = new List <ContingencyEntry>(); entries = installer.InstallPackage(Path, InstallMode, log, entries, out hasPostAction, out historyPath); installer.ExecutePostInstallationInstructions(Path, historyPath, InstallMode, view, log, ref entries); foreach (var entry in entries) { WriteObject(entry); } //UpdateHelper.SaveInstallationMessages(entries, historyPath); }); } }
protected override void ProcessRecord() { // Use default logger var log = LogManager.GetLogger("root"); XmlConfigurator.Configure((XmlElement) ConfigurationManager.GetSection("log4net")); if (ShouldProcess(Path, "Install update package")) { PerformInstallAction( () => { var installer = new DiffInstaller(UpgradeAction); var view = UpdateHelper.LoadMetadata(Path); bool hasPostAction; string historyPath; var entries = new List<ContingencyEntry>(); entries = installer.InstallPackage(Path, InstallMode, log, entries, out hasPostAction, out historyPath); installer.ExecutePostInstallationInstructions(Path, historyPath, InstallMode, view, log, ref entries); foreach (var entry in entries) { WriteObject(entry); } //UpdateHelper.SaveInstallationMessages(entries, historyPath); }); } }
public void InstallPackage(string path) { using (new SecurityDisabler()) { var installer = new DiffInstaller(UpgradeAction.Upgrade); var view = UpdateHelper.LoadMetadata(path); string historyPath; bool hasPostAction; var entries = installer.InstallPackage(path, InstallMode.Install, null, out hasPostAction, out historyPath); installer.ExecutePostInstallationInstructions(path, historyPath, InstallMode.Install, view, null, ref entries); UpdateHelper.SaveInstallationMessages(entries, historyPath); } }
public List <InstalledItems> installSitecoreUpdatePackage(string path) { checkFile(path); using (new SecurityDisabler()) { var installer = new DiffInstaller(UpgradeAction.Upgrade); var view = UpdateHelper.LoadMetadata(path); //Get the package entries bool hasPostAction; string historyPath; try { var entries = installer.InstallPackage(path, InstallMode.Install, log(), out hasPostAction, out historyPath); installer.ExecutePostInstallationInstructions(path, historyPath, InstallMode.Install, view, log(), ref entries); var installedItems = new List <InstalledItems>(); installedItems = entries.Select( x => new InstalledItems { Action = x.Action, ItemPath = _split(x.LongDescription, "Item path"), ItemGUID = _split(x.LongDescription, "Item ID"), MessageType = x.MessageGroupDescription }).ToList(); return(installedItems); } catch (PostStepInstallerException exception) { foreach (var entry in exception.Entries) { log().Info(entry.Message); } throw exception; } } }