Bug Fix #53: Plugin install fails when dll loaded

This commit is contained in:
Gary Sharp
2014-07-07 15:19:46 +10:00
parent 0b79140290
commit 67a624d5b5
2 changed files with 18 additions and 22 deletions
+12 -8
View File
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using Disco.Data.Repository;
using Disco.Services.Tasks;
using Quartz;
using System;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Disco.Data.Repository;
using Disco.Services.Tasks;
using Quartz;
namespace Disco.Services.Plugins
{
@@ -109,7 +106,14 @@ namespace Disco.Services.Plugins
if (Directory.Exists(packagePath))
{
this.Status.UpdateStatus(25, "Removing Existing Files");
Directory.Delete(packagePath, true);
try
{
Directory.Delete(packagePath, true);
}
catch (UnauthorizedAccessException)
{
throw new InvalidOperationException("Unable to delete existing plugin files, they may be locked by another process. Please restart Disco ICT and try installing the plugin again.");
}
}
Directory.CreateDirectory(packagePath);
+6 -14
View File
@@ -1,16 +1,14 @@
using System;
using Disco.Data.Repository;
using Disco.Models.BI.Interop.Community;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using Disco.Data.Repository;
using System.IO.Compression;
using Disco.Models.BI.Interop.Community;
using System.Web;
using Newtonsoft.Json;
using System.Threading;
using System.Web;
namespace Disco.Services.Plugins
{
@@ -482,12 +480,6 @@ namespace Disco.Services.Plugins
packageManifest = PluginManifest.FromPluginManifestFile(packageManifestStream);
}
if (ExistingManifest.Version == packageManifest.Version)
{
// Skip Update if already installed
PluginsLog.LogInitializeWarning(string.Format("This plugin [{0}] version [{1}] is already installed, skipping Update", ExistingManifest.Id, ExistingManifest.Version));
return ExistingManifest;
}
if (ExistingManifest.Version > packageManifest.Version)
{
throw new InvalidDataException("A newer version of this plugin is already installed");