Logging the error if a package can't be installed

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-02-28 15:14:07 -08:00
parent 03e034746d
commit 3002233784

View File

@@ -6,6 +6,7 @@ using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models; using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.VirtualPath; using Orchard.FileSystems.VirtualPath;
using Orchard.Localization; using Orchard.Localization;
using Orchard.Logging;
using Orchard.Packaging.Extensions; using Orchard.Packaging.Extensions;
using Orchard.Packaging.Models; using Orchard.Packaging.Models;
using Orchard.UI; using Orchard.UI;
@@ -35,9 +36,11 @@ namespace Orchard.Packaging.Services {
_folderUpdater = folderUpdater; _folderUpdater = folderUpdater;
T = NullLocalizer.Instance; T = NullLocalizer.Instance;
Logger = Logging.NullLogger.Instance;
} }
public Localizer T { get; set; } public Localizer T { get; set; }
public Logging.ILogger Logger { get; set; }
public PackageInfo Install(string packageId, string version, string location, string applicationPath) { public PackageInfo Install(string packageId, string version, string location, string applicationPath) {
// instantiates the appropriate package repository // instantiates the appropriate package repository
@@ -95,6 +98,8 @@ namespace Orchard.Packaging.Services {
// just uninstall the new package // just uninstall the new package
Uninstall(package.Id, _virtualPathProvider.MapPath("~\\")); Uninstall(package.Id, _virtualPathProvider.MapPath("~\\"));
} }
Logger.Error(String.Format("The package is compatible with version {0} and above. Please update Orchard or install another version of this package.", descriptor.OrchardVersion));
throw new OrchardException(T("The package is compatible with version {0} and above. Please update Orchard or install another version of this package.", descriptor.OrchardVersion)); throw new OrchardException(T("The package is compatible with version {0} and above. Please update Orchard or install another version of this package.", descriptor.OrchardVersion));
} }
} }