/// <summary>
/// Uninstall package
/// </summary>
/// <param name="pkgId"></param>
/// <returns></returns>
public static bool UninstallPackage(string pkgId)
{
try
{
FileSystem.UninstallPackage(pkgId);
Utils.Log(string.Format("Uninstalled package {0}: installed package files removed. ", pkgId));
// remove packagefiles.xml and packages.xml (or DB records)
BlogService.DeletePackage(pkgId);
Utils.Log(string.Format("Uninstalled package {0}: package records removed. ", pkgId));
UninstallGalleryPackage(pkgId);
Utils.Log(string.Format("Uninstalled package {0}: NuGet file removed. ", pkgId));
// reset cache
Blog.CurrentInstance.Cache.Remove(Constants.CacheKey);
Utils.Log(string.Format("Uninstalled package {0} by {1}", pkgId, Security.CurrentUser.Identity.Name));
}
catch (Exception ex)
{
Utils.Log(string.Format("Error unistalling package {0}: {1}"), pkgId, ex.Message);
throw;
}
return(true);
}