Update: Disco Online Services Update Checking
Migrates Disco Update checking to new services at https://services.discoict.com.au.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
@@ -70,10 +71,10 @@ namespace Disco.Web
|
||||
Disco.Services.Tasks.ScheduledTasks.InitalizeScheduledTasks(Database, DiscoApplication.SchedulerFactory, true);
|
||||
|
||||
// Schedule Immediate Check for Update (if never updated, or last updated over 2 days ago)
|
||||
if (Database.DiscoConfiguration.UpdateLastCheck == null ||
|
||||
Database.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-2))
|
||||
if (Database.DiscoConfiguration.UpdateLastCheckResponse == null ||
|
||||
Database.DiscoConfiguration.UpdateLastCheckResponse.UpdateResponseDate < DateTime.Now.AddDays(-2))
|
||||
{
|
||||
Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
|
||||
UpdateQueryTask.ScheduleNow();
|
||||
}
|
||||
|
||||
// Setup Attachment Monitor
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using Disco.Services.Web;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -66,7 +67,7 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
[DiscoAuthorize(Claims.Config.System.Show)]
|
||||
public virtual ActionResult UpdateCheck()
|
||||
{
|
||||
var ts = Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
|
||||
var ts = Disco.Services.Interop.DiscoServices.UpdateQueryTask.ScheduleNow();
|
||||
ts.SetFinishedUrl(Url.Action(MVC.Config.SystemConfig.Index()));
|
||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(ts.SessionId));
|
||||
}
|
||||
@@ -354,10 +355,10 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
Database.SaveChanges();
|
||||
|
||||
// Try and check for updates if needed - After Proxy Changed
|
||||
if (Database.DiscoConfiguration.UpdateLastCheck == null
|
||||
|| Database.DiscoConfiguration.UpdateLastCheck.ResponseTimestamp < DateTime.Now.AddDays(-1))
|
||||
if (Database.DiscoConfiguration.UpdateLastCheckResponse == null
|
||||
|| Database.DiscoConfiguration.UpdateLastCheckResponse.UpdateResponseDate < DateTime.Now.AddDays(-1))
|
||||
{
|
||||
Disco.BI.Interop.Community.UpdateCheckTask.ScheduleNow();
|
||||
UpdateQueryTask.ScheduleNow();
|
||||
}
|
||||
|
||||
if (redirect)
|
||||
@@ -369,4 +370,4 @@ namespace Disco.Web.Areas.API.Controllers
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Disco.Web.Areas.Config.Controllers
|
||||
|
||||
var m = new Models.Config.IndexModel()
|
||||
{
|
||||
UpdateResponse = Database.DiscoConfiguration.UpdateLastCheck
|
||||
UpdateResponse = Database.DiscoConfiguration.UpdateLastCheckResponse
|
||||
};
|
||||
|
||||
return View(m);
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Models.BI.Interop.Community;
|
||||
using Disco.Models.Services.Interop.DiscoServices;
|
||||
using System;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.Config
|
||||
{
|
||||
@@ -14,13 +11,14 @@ namespace Disco.Web.Areas.Config.Models.Config
|
||||
{
|
||||
if (UpdateResponse != null)
|
||||
{
|
||||
var updateVersion = Version.Parse(UpdateResponse.Version);
|
||||
var updateVersion = Version.Parse(UpdateResponse.LatestVersion);
|
||||
return (updateVersion > typeof(DiscoApplication).Assembly.GetName().Version);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public UpdateResponse UpdateResponse { get; set; }
|
||||
|
||||
public UpdateResponseV2 UpdateResponse { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
using System;
|
||||
using Disco.Data.Configuration;
|
||||
using Disco.Models.Services.Interop.DiscoServices;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using Disco.Services.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Disco.Data.Configuration;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Data.SqlClient;
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Models.BI.Interop.Community;
|
||||
using Disco.Services.Tasks;
|
||||
using System.DirectoryServices.ActiveDirectory;
|
||||
using Disco.Services.Interop.ActiveDirectory;
|
||||
using System.Linq;
|
||||
|
||||
namespace Disco.Web.Areas.Config.Models.SystemConfig
|
||||
{
|
||||
@@ -98,7 +96,8 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
|
||||
|
||||
public ScheduledTaskStatus UpdateRunningStatus { get; set; }
|
||||
public DateTime? UpdateNextScheduled { get; set; }
|
||||
public UpdateResponse UpdateLatestResponse { get; set; }
|
||||
public UpdateResponseV2 UpdateLatestResponse { get; set; }
|
||||
public bool UpdateAvailable { get; set; }
|
||||
public bool UpdateBetaDeployment { get; set; }
|
||||
|
||||
public static IndexModel FromConfiguration(SystemConfiguration config)
|
||||
@@ -111,12 +110,15 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
|
||||
ProxyPort = config.ProxyPort,
|
||||
ProxyUsername = config.ProxyUsername,
|
||||
ProxyPassword = config.ProxyPassword,
|
||||
UpdateLatestResponse = config.UpdateLastCheck,
|
||||
UpdateRunningStatus = Disco.BI.Interop.Community.UpdateCheckTask.RunningStatus,
|
||||
UpdateNextScheduled = Disco.BI.Interop.Community.UpdateCheckTask.NextScheduled,
|
||||
UpdateLatestResponse = config.UpdateLastCheckResponse,
|
||||
UpdateRunningStatus = UpdateQueryTask.RunningStatus,
|
||||
UpdateNextScheduled = UpdateQueryTask.NextScheduled,
|
||||
UpdateBetaDeployment = config.UpdateBetaDeployment
|
||||
};
|
||||
|
||||
// Is an update available?
|
||||
m.UpdateAvailable = m.UpdateLatestResponse != null && (Version.Parse(m.UpdateLatestResponse.LatestVersion) > m.DiscoVersion);
|
||||
|
||||
// AD
|
||||
m.ADDomains = ActiveDirectory.Context.Domains.ToList();
|
||||
m.ADPrimaryDomain = ActiveDirectory.Context.PrimaryDomain;
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
<div id="updateAvailableContainer">
|
||||
<i class="fa fa-cloud-download info"></i>
|
||||
<div>An updated version of Disco is available</div>
|
||||
<a href="@Model.UpdateResponse.UrlLink" class="button small alert" target="_blank">Download v@(Model.UpdateResponse.Version)</a>
|
||||
<a href="@Model.UpdateResponse.UrlLink" class="button small alert" target="_blank">Download v@(Model.UpdateResponse.LatestVersion)</a>
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
@@ -154,7 +154,7 @@
|
||||
var updateAvailableContainer = $('#updateAvailableContainer');
|
||||
updateAvailableContainer.appendTo(layout_PageHeading);
|
||||
@{
|
||||
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-14))
|
||||
if (Model.UpdateResponse.ReleasedDate < DateTime.Now.AddDays(-14))
|
||||
{
|
||||
<text>
|
||||
updateAvailableContainer.effect("shake", { times: 3 }, 500);
|
||||
|
||||
@@ -930,7 +930,7 @@ WriteLiteral(">Download v");
|
||||
|
||||
|
||||
#line 148 "..\..\Areas\Config\Views\Config\Index.cshtml"
|
||||
Write(Model.UpdateResponse.Version);
|
||||
Write(Model.UpdateResponse.LatestVersion);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -954,7 +954,7 @@ WriteLiteral(@" <script>
|
||||
|
||||
#line 156 "..\..\Areas\Config\Views\Config\Index.cshtml"
|
||||
|
||||
if (Model.UpdateResponse.VersionReleasedTimestamp < DateTime.Now.AddDays(-14))
|
||||
if (Model.UpdateResponse.ReleasedDate < DateTime.Now.AddDays(-14))
|
||||
{
|
||||
|
||||
|
||||
|
||||
@@ -85,22 +85,22 @@
|
||||
<th style="width: 135px">Last Run:
|
||||
</th>
|
||||
<td>
|
||||
<span>@CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ResponseTimestamp)</span>
|
||||
<span>@CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.UpdateResponseDate.ToLocalTime())</span>
|
||||
</td>
|
||||
</tr>
|
||||
if (Model.UpdateLatestResponse.IsUpdatable(typeof(DiscoApplication).Assembly.GetName().Version))
|
||||
if (Model.UpdateAvailable)
|
||||
{
|
||||
<tr>
|
||||
<th style="width: 135px">Update Available:
|
||||
</th>
|
||||
<td>
|
||||
<div>
|
||||
<i class="fa fa-info-circle fa-lg information"></i> Version @(Model.UpdateLatestResponse.Version) is available
|
||||
<i class="fa fa-info-circle fa-lg information"></i> Version @(Model.UpdateLatestResponse.LatestVersion) is available
|
||||
</div>
|
||||
<div class="smallMessage">
|
||||
[Released @(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.VersionReleasedTimestamp))]
|
||||
[Released @(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ReleasedDate))]
|
||||
</div>
|
||||
<div class="smallMessage">@(new HtmlString(Model.UpdateLatestResponse.Blurb))</div>
|
||||
<div class="smallMessage">@(new HtmlString(Model.UpdateLatestResponse.Description))</div>
|
||||
<a href="@(Model.UpdateLatestResponse.UrlLink)" target="_blank">Download Now</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -536,15 +536,20 @@
|
||||
}
|
||||
var ajaxLoading = button.next('.ajaxLoading').first().show();
|
||||
|
||||
$.getJSON(url, data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change property "' + UpdatePropertyName + '":\n' + response);
|
||||
ajaxLoading.hide();
|
||||
} else {
|
||||
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: data,
|
||||
success: function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change property "' + UpdatePropertyName + '":\n' + response);
|
||||
ajaxLoading.hide();
|
||||
} else {
|
||||
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -269,7 +269,7 @@ WriteLiteral(">Last Run:\r\n </th>\r\n <td>\r\n
|
||||
|
||||
|
||||
#line 88 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ResponseTimestamp));
|
||||
Write(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.UpdateResponseDate.ToLocalTime()));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -278,7 +278,7 @@ WriteLiteral("</span>\r\n </td>\r\n </tr>\r\n");
|
||||
|
||||
|
||||
#line 91 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
if (Model.UpdateLatestResponse.IsUpdatable(typeof(DiscoApplication).Assembly.GetName().Version))
|
||||
if (Model.UpdateAvailable)
|
||||
{
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ WriteLiteral("></i> Version ");
|
||||
|
||||
|
||||
#line 98 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Model.UpdateLatestResponse.Version);
|
||||
Write(Model.UpdateLatestResponse.LatestVersion);
|
||||
|
||||
|
||||
#line default
|
||||
@@ -310,7 +310,7 @@ WriteLiteral(">\r\n [Released ");
|
||||
|
||||
|
||||
#line 101 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.VersionReleasedTimestamp));
|
||||
Write(CommonHelpers.FriendlyDate(Model.UpdateLatestResponse.ReleasedDate));
|
||||
|
||||
|
||||
#line default
|
||||
@@ -323,21 +323,21 @@ WriteLiteral(">");
|
||||
|
||||
|
||||
#line 103 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(new HtmlString(Model.UpdateLatestResponse.Blurb));
|
||||
Write(new HtmlString(Model.UpdateLatestResponse.Description));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("</div>\r\n <a");
|
||||
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 3996), Tuple.Create("\"", 4040)
|
||||
WriteAttribute("href", Tuple.Create(" href=\"", 3941), Tuple.Create("\"", 3985)
|
||||
|
||||
#line 104 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 4003), Tuple.Create<System.Object, System.Int32>(Model.UpdateLatestResponse.UrlLink
|
||||
, Tuple.Create(Tuple.Create("", 3948), Tuple.Create<System.Object, System.Int32>(Model.UpdateLatestResponse.UrlLink
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 4003), false)
|
||||
, 3948), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" target=\"_blank\"");
|
||||
@@ -704,18 +704,18 @@ WriteLiteral(" <i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-exclamation warning fa-fw fa-lg\"");
|
||||
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 8221), Tuple.Create("\"", 8304)
|
||||
, Tuple.Create(Tuple.Create("", 8229), Tuple.Create("Unavailable,", 8229), true)
|
||||
, Tuple.Create(Tuple.Create(" ", 8241), Tuple.Create("will", 8242), true)
|
||||
, Tuple.Create(Tuple.Create(" ", 8246), Tuple.Create("retry", 8247), true)
|
||||
, Tuple.Create(Tuple.Create(" ", 8252), Tuple.Create("at", 8253), true)
|
||||
WriteAttribute("title", Tuple.Create(" title=\"", 8166), Tuple.Create("\"", 8249)
|
||||
, Tuple.Create(Tuple.Create("", 8174), Tuple.Create("Unavailable,", 8174), true)
|
||||
, Tuple.Create(Tuple.Create(" ", 8186), Tuple.Create("will", 8187), true)
|
||||
, Tuple.Create(Tuple.Create(" ", 8191), Tuple.Create("retry", 8192), true)
|
||||
, Tuple.Create(Tuple.Create(" ", 8197), Tuple.Create("at", 8198), true)
|
||||
|
||||
#line 203 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
, Tuple.Create(Tuple.Create(" ", 8255), Tuple.Create<System.Object, System.Int32>(server.AvailableWhen.Value.ToLongTimeString()
|
||||
, Tuple.Create(Tuple.Create(" ", 8200), Tuple.Create<System.Object, System.Int32>(server.AvailableWhen.Value.ToLongTimeString()
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 8256), false)
|
||||
, 8201), false)
|
||||
);
|
||||
|
||||
WriteLiteral("></i>\r\n");
|
||||
@@ -1639,35 +1639,29 @@ WriteLiteral("\r\n <script>\r\n $(func
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"';
|
||||
var data = {
|
||||
ProxyAddress: $('#ProxyAddress').val(),
|
||||
ProxyPort: $('#ProxyPort').val(),
|
||||
ProxyUsername: $('#ProxyUsername').val(),
|
||||
ProxyPassword: $('#ProxyPassword').val()
|
||||
}
|
||||
var ajaxLoading = button.next('.ajaxLoading').first().show();
|
||||
|
||||
$.getJSON(url, data, function (response, result) {
|
||||
if (result != 'success' || response != 'OK') {
|
||||
alert('Unable to change property ""' + UpdatePropertyName + '"":\n' + response);
|
||||
ajaxLoading.hide();
|
||||
} else {
|
||||
ajaxLoading.hide().next('.ajaxOk').show().delay('fast').fadeOut('slow');
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
");
|
||||
WriteLiteral("\';\r\n var data = {\r\n " +
|
||||
" ProxyAddress: $(\'#ProxyAddress\').val(),\r\n " +
|
||||
" ProxyPort: $(\'#ProxyPort\').val(),\r\n ProxyUs" +
|
||||
"ername: $(\'#ProxyUsername\').val(),\r\n ProxyPas" +
|
||||
"sword: $(\'#ProxyPassword\').val()\r\n }\r\n " +
|
||||
" var ajaxLoading = button.next(\'.ajaxLoading\').first().show(" +
|
||||
");\r\n\r\n $.ajax({\r\n " +
|
||||
" type: \'POST\',\r\n dataType: \'json\',\r\n " +
|
||||
" url: url,\r\n dat" +
|
||||
"a: data,\r\n success: function (response, resul" +
|
||||
"t) {\r\n if (result != \'success\' || respons" +
|
||||
"e != \'OK\') {\r\n alert(\'Unable to chang" +
|
||||
"e property \"\' + UpdatePropertyName + \'\":\\n\' + response);\r\n " +
|
||||
" ajaxLoading.hide();\r\n " +
|
||||
" } else {\r\n ajaxLoading.hide().next" +
|
||||
"(\'.ajaxOk\').show().delay(\'fast\').fadeOut(\'slow\');\r\n " +
|
||||
" }\r\n }\r\n " +
|
||||
" });\r\n });\r\n });\r\n " +
|
||||
" </script>\r\n </td>\r\n </tr>\r\n </table" +
|
||||
">\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 555 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 560 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1692,7 +1686,7 @@ WriteLiteral(">Address:\r\n </th>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 566 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 571 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.ProxyAddress));
|
||||
|
||||
|
||||
@@ -1708,7 +1702,7 @@ WriteLiteral(">Port:\r\n </th>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 573 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 578 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.ProxyPort));
|
||||
|
||||
|
||||
@@ -1724,7 +1718,7 @@ WriteLiteral(">Username:\r\n </th>\r\n <td>\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 580 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 585 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.DisplayFor(m => m.ProxyUsername));
|
||||
|
||||
|
||||
@@ -1739,7 +1733,7 @@ WriteLiteral(">Password:\r\n </th>\r\n <td>*******
|
||||
"</td>\r\n </tr>\r\n </table>\r\n </div>\r\n");
|
||||
|
||||
|
||||
#line 591 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 596 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
}
|
||||
|
||||
|
||||
@@ -1754,7 +1748,7 @@ WriteLiteral(">\r\n");
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 593 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
#line 598 "..\..\Areas\Config\Views\SystemConfig\Index.cshtml"
|
||||
Write(Html.ActionLinkButton("Update Device Last Network Logons", MVC.API.System.UpdateLastNetworkLogonDates()));
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using Disco.Data.Repository;
|
||||
using Disco.Services.Authorization;
|
||||
using Disco.Services.Users;
|
||||
using Disco.Services.Interop.DiscoServices;
|
||||
using Disco.Services.Web;
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Web;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
@@ -44,13 +42,13 @@ namespace Disco.Web
|
||||
{
|
||||
// Check for Post-Update
|
||||
var previousVersion = database.DiscoConfiguration.InstalledDatabaseVersion;
|
||||
bool isVersionUpdate = previousVersion != Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion();
|
||||
bool isVersionUpdate = previousVersion != UpdateQuery.CurrentDiscoVersion();
|
||||
bool ignoreVersionUpdate = false;
|
||||
|
||||
if (isVersionUpdate)
|
||||
{
|
||||
// Update Database with New Version
|
||||
database.DiscoConfiguration.InstalledDatabaseVersion = Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion();
|
||||
database.DiscoConfiguration.InstalledDatabaseVersion = UpdateQuery.CurrentDiscoVersion();
|
||||
database.SaveChanges();
|
||||
|
||||
// Check if configured to Ignore Plugin Updates (Mainly for Dev environment)
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Disco.Services.Interop.VicEduDept;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using System.Xml.Linq;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Disco.Web.Models.InitialConfig
|
||||
{
|
||||
public class WelcomeModel
|
||||
{
|
||||
[Required(ErrorMessage="The Organisation Name is required.")]
|
||||
[Required(ErrorMessage = "The Organisation Name is required.")]
|
||||
public string OrganisationName { get; set; }
|
||||
|
||||
|
||||
@@ -25,69 +19,17 @@ namespace Disco.Web.Models.InitialConfig
|
||||
return true;
|
||||
}
|
||||
|
||||
// DnsQuery for broadband.doe.wan
|
||||
IPHostEntry doeWanDnsEntry;
|
||||
try
|
||||
var whoAmIResult = VicSmart.WhoAmI();
|
||||
|
||||
if (whoAmIResult != null && !string.IsNullOrWhiteSpace(whoAmIResult.Item2))
|
||||
{
|
||||
doeWanDnsEntry = Dns.GetHostEntry("broadband.doe.wan");
|
||||
}
|
||||
catch (Exception)
|
||||
{ return false; } // Fail on error
|
||||
|
||||
// Try using IPSearch feature
|
||||
XDocument doeWanIPSearchResult = TryDownloadDoeIPSearch(true);
|
||||
if (doeWanIPSearchResult == null)
|
||||
doeWanIPSearchResult = TryDownloadDoeIPSearch(false);
|
||||
|
||||
if (doeWanIPSearchResult == null)
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
var siteName = doeWanIPSearchResult.Element("resultset").Element("site").Element("name").Value.ToLower();
|
||||
this.OrganisationName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(siteName);
|
||||
this.OrganisationName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(whoAmIResult.Item2);
|
||||
_OrganisationNameCache = this.OrganisationName;
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{ return false; } // Fail on error
|
||||
}
|
||||
private XDocument TryDownloadDoeIPSearch(bool useProxy)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest wReq = (HttpWebRequest)HttpWebRequest.Create("http://broadband.doe.wan/ipsearch/showresult.php");
|
||||
// Added: 2013-02-08 G#
|
||||
// Fix for Proxy Servers which dont support KeepAlive
|
||||
wReq.KeepAlive = false;
|
||||
// End Added: 2013-02-08 G#
|
||||
if (!useProxy)
|
||||
wReq.Proxy = new WebProxy(); // Empty Proxy Config
|
||||
wReq.Method = WebRequestMethods.Http.Post;
|
||||
wReq.ContentType = "application/x-www-form-urlencoded";
|
||||
wReq.UserAgent = string.Format("Disco/{0}", DiscoApplication.Version);
|
||||
using (var wrStream = wReq.GetRequestStream())
|
||||
{
|
||||
using (var wrStreamWriter = new StreamWriter(wrStream))
|
||||
{
|
||||
wrStreamWriter.Write("mode=whoami");
|
||||
}
|
||||
}
|
||||
using (HttpWebResponse wRes = (HttpWebResponse)wReq.GetResponse())
|
||||
{
|
||||
if (wRes.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
using (var wResStream = wRes.GetResponseStream())
|
||||
{
|
||||
return XDocument.Load(wResStream);
|
||||
}
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{ return null; } // Fail on error
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user