merge commit

This commit is contained in:
robvde 2013-09-21 11:56:18 +04:00
commit dd462e4c6a
37 changed files with 8177 additions and 666 deletions

View file

@ -266,6 +266,20 @@ namespace WebsitePanel.Server.Code
return products;
}
public Product GetWPIProductById(string productId)
{
foreach (Product product in _productManager.Products)
{
if (0 == String.Compare(product.ProductId, productId, StringComparison.OrdinalIgnoreCase))
{
return product;
}
}
return null; //not found
}
public List<Product> GetProductsToInstall(IEnumerable<string> productIdsToInstall)
{
@ -582,7 +596,6 @@ namespace WebsitePanel.Server.Code
private void Initialize()
{
// create cache folder if not exists
//_webPIinstallersFolder = Environment.ExpandEnvironmentVariables(@"%LocalAppData%\Microsoft\Web Platform Installer\installers");
_webPIinstallersFolder = Path.Combine(
Environment.ExpandEnvironmentVariables("%SystemRoot%"),
"Temp\\zoo.wpi\\AppData\\Local\\Microsoft\\Web Platform Installer\\installers");
@ -608,11 +621,12 @@ namespace WebsitePanel.Server.Code
_productManager = new ProductManager();
if (TryLoadFeeds())
try
{
TryLoadFeeds();
// ok, all feeds loaded
}
else
catch(Exception ex1)
{
// feed loading failed
@ -623,23 +637,25 @@ namespace WebsitePanel.Server.Code
// re-create product manager
_productManager = new ProductManager();
if (TryLoadFeeds())
try
{
// loaded first (default) feed only
TryLoadFeeds();
}
else
catch(Exception ex2)
{
throw new Exception(string.Format("WpiHelper: download all feeds failed"));
throw new Exception(string.Format("WpiHelper: download first feed failed: {0}", ex2), ex2);
}
}
else
{
throw new Exception(string.Format("WpiHelper: download all feeds failed"));
throw new Exception(string.Format("WpiHelper: download all ({0}) feeds failed: {1}", _feeds.Count, ex1), ex1);
}
}
}
private bool TryLoadFeeds()
private void TryLoadFeeds()
{
string loadingFeed = null;
@ -667,12 +683,9 @@ namespace WebsitePanel.Server.Code
// error occured on loading this feed
// log this
WriteLog(string.Format("Feed {0} loading error: {1}", loadingFeed, ex));
return false;
}
throw;
}
return true;
}
private Language GetLanguage(string languageId)

View file

@ -101,5 +101,17 @@ namespace WebsitePanel.Server
{
ZooProvider.SetEnabledEnginesForSite(siteId, engineNames);
}
[WebMethod, SoapHeader("settings")]
public bool IsWebCosoleEnabled()
{
return ZooProvider.IsWebCosoleEnabled();
}
[WebMethod, SoapHeader("settings")]
public void SetWebCosoleEnabled(bool enabled)
{
ZooProvider.SetWebCosoleEnabled(enabled);
}
}
}

View file

@ -1093,6 +1093,82 @@ namespace WebsitePanel.Server
throw;
}
}
#endregion
#region Helicon Zoo
[WebMethod, SoapHeader("settings")]
public WebVirtualDirectory[] GetZooApplications(string siteId)
{
try
{
Log.WriteStart("'{0}' GetZooApplications", ProviderSettings.ProviderName);
WebVirtualDirectory[] result = WebProvider.GetZooApplications(siteId);
Log.WriteEnd("'{0}' GetZooApplications", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' GetZooApplications", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public StringResultObject SetZooEnvironmentVariable(string siteId, string appName, string envName, string envValue)
{
try
{
Log.WriteStart("'{0}' SetZooEnvironmentVariable", ProviderSettings.ProviderName);
StringResultObject result = WebProvider.SetZooEnvironmentVariable(siteId, appName, envName, envValue);
Log.WriteEnd("'{0}' SetZooEnvironmentVariable", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' SetZooEnvironmentVariable", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public StringResultObject SetZooConsoleEnabled(string siteId, string appName)
{
try
{
Log.WriteStart("'{0}' SetZooConsoleEnabled", ProviderSettings.ProviderName);
StringResultObject result = WebProvider.SetZooConsoleEnabled(siteId, appName);
Log.WriteEnd("'{0}' SetZooConsoleEnabled", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' SetZooConsoleEnabled", ProviderSettings.ProviderName), ex);
throw;
}
}
[WebMethod, SoapHeader("settings")]
public StringResultObject SetZooConsoleDisabled(string siteId, string appName)
{
try
{
Log.WriteStart("'{0}' SetZooConsoleDisabled", ProviderSettings.ProviderName);
StringResultObject result = WebProvider.SetZooConsoleDisabled(siteId, appName);
Log.WriteEnd("'{0}' SetZooConsoleDisabled", ProviderSettings.ProviderName);
return result;
}
catch (Exception ex)
{
Log.WriteError(String.Format("'{0}' SetZooConsoleDisabled", ProviderSettings.ProviderName), ex);
throw;
}
}
#endregion
#region Web Application Gallery

View file

@ -360,20 +360,50 @@ namespace WebsitePanel.Server
{
foreach (WPIProduct product in products)
{
string installedHostingPackageVersion = GetInstalledHostingPackageVersion(product.ProductId);
if (!string.IsNullOrEmpty(installedHostingPackageVersion) && string.Compare(product.Version, installedHostingPackageVersion, StringComparison.OrdinalIgnoreCase) > 0)
{
product.IsUpgrade = true;
}
string hostingPackageName = product.ProductId;
CheckProductForUpdate(hostingPackageName, product);
}
}
private string GetInstalledHostingPackageVersion(string productId)
private void CheckProductForUpdate(string hostingPackageName, WPIProduct product)
{
string installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Helicon\\Zoo", productId+"Version", string.Empty) as string;
string installedHostingPackageVersion = GetInstalledHostingPackageVersion(hostingPackageName);
if (!string.IsNullOrEmpty(installedHostingPackageVersion))
{
//6
//3.0.90.383
if (CompareVersions(product.Version, installedHostingPackageVersion) > 0)
{
product.IsUpgrade = true;
product.IsInstalled = false;
}
}
}
private decimal CompareVersions(string newVersion, string oldVersion)
{
try
{
var version1 = new Version(newVersion);
var version2 = new Version(oldVersion);
return version1.CompareTo(version2);
}
catch (ArgumentException)
{
return String.Compare(newVersion,oldVersion, StringComparison.Ordinal);
}
}
private string GetInstalledHostingPackageVersion(string hostingPackageName)
{
string installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Helicon\\Zoo", hostingPackageName + "Version", string.Empty) as string;
if (string.IsNullOrEmpty(installedVersion))
{
installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Helicon\\Zoo", productId + "Version", string.Empty) as string;
installedVersion = Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Helicon\\Zoo", hostingPackageName + "Version", string.Empty) as string;
}
return installedVersion;
@ -480,6 +510,33 @@ namespace WebsitePanel.Server
}
}
[WebMethod]
public WPIProduct GetWPIProductById(string productdId)
{
try
{
Log.WriteStart("GetWPIProductById");
WpiHelper wpi = GetWpiFeed();
Product product = wpi.GetWPIProductById(productdId);
WPIProduct wpiProduct = ProductToWPIProduct(product);
if (wpiProduct.ProductId == "HeliconZooModule")
{
/*null string = HeliconZooModule in registry*/
CheckProductForUpdate("", wpiProduct);
}
Log.WriteEnd("GetWPIProductById");
return wpiProduct;
}
catch (Exception ex)
{
Log.WriteError("GetWPIProductById", ex);
throw;
}
}
[WebMethod]
public WPITab[] GetWPITabs()
{