Skip to content

Commit 5de8003

Browse files
committed
System info: Show name of the data provider, show (assembly) creation date (to easier detect beta versions)
1 parent 4d8a4ac commit 5de8003

6 files changed

Lines changed: 88 additions & 17 deletions

File tree

src/Libraries/SmartStore.Core/Data/DataSettings.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,18 @@ public string ProviderInvariantName
122122
}
123123
}
124124

125+
public string ProviderFriendlyName
126+
{
127+
get
128+
{
129+
if (this.DataProvider.HasValue() && this.DataProvider.IsCaseInsensitiveEqual("sqlserver"))
130+
return "SQL Server";
131+
132+
// SqlCe should always be the default provider
133+
return "SQL Server Compact (SQL CE)";
134+
}
135+
}
136+
125137
public bool IsSqlServer
126138
{
127139
get

src/Libraries/SmartStore.Data/Migrations/201408071158147_MultistorePoll.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
6363
"Höhe des gekürzten Langtextes",
6464
"Determines the height of the truncated long text.",
6565
"Legt die Höhe (in Pixel) des gekürzten Langtextes fest.");
66+
67+
68+
builder.AddOrUpdate("Admin.System.SystemInfo.DataProviderFriendlyName",
69+
"Data provider",
70+
"Daten-Provider",
71+
"The name of the data provider.",
72+
"Der Name des Daten-Providers.");
73+
74+
builder.AddOrUpdate("Admin.System.SystemInfo.AppDate",
75+
"Created on",
76+
"Erstellt am",
77+
"The creation date of this SmartStore.NET version.",
78+
"Das Erstellungsdatum dieser SmartStore.NET Version.");
6679
}
6780
}
6881
}

src/Presentation/SmartStore.Web/Administration/Controllers/CommonController.cs

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
using Telerik.Web.Mvc;
3232
using SmartStore.Services.Common;
3333
using SmartStore.Core.Domain.Common;
34+
using System.Reflection;
3435

3536
namespace SmartStore.Admin.Controllers
3637
{
@@ -54,14 +55,14 @@ public class CommonController : AdminControllerBase
5455
private readonly IStoreContext _storeContext;
5556
private readonly IPermissionService _permissionService;
5657
private readonly ILocalizationService _localizationService;
57-
private readonly IImageCache _imageCache; // codehint: sm-add
58-
private readonly SecuritySettings _securitySettings; // codehint: sm-add
59-
private readonly ITypeFinder _typeFinder; // codehint: sm-add
60-
private readonly IPluginFinder _pluginFinder; // codehint: sm-add
61-
private readonly IGenericAttributeService _genericAttributeService; // codehint: sm-add
62-
private readonly IDbContext _dbContext; // codehint: sm-add
58+
private readonly IImageCache _imageCache;
59+
private readonly SecuritySettings _securitySettings;
60+
private readonly ITypeFinder _typeFinder;
61+
private readonly IPluginFinder _pluginFinder;
62+
private readonly IGenericAttributeService _genericAttributeService;
63+
private readonly IDbContext _dbContext;
6364

64-
private readonly static object _lock = new object(); // codehint: sm-add
65+
private readonly static object _lock = new object();
6566

6667
#endregion
6768

@@ -104,12 +105,12 @@ public CommonController(IPaymentService paymentService,
104105
this._storeContext = storeContext;
105106
this._permissionService = permissionService;
106107
this._localizationService = localizationService;
107-
this._imageCache = imageCache; // codehint: sm-add
108-
this._securitySettings = securitySettings; // codehint: sm-add
109-
this._typeFinder = typeFinder; // codehint: sm-add
110-
this._pluginFinder = pluginFinder; // codehint: sm-add
111-
this._genericAttributeService = genericAttributeService; // codehint: sm-add
112-
this._dbContext = dbContext; // codehint: sm-add
108+
this._imageCache = imageCache;
109+
this._securitySettings = securitySettings;
110+
this._typeFinder = typeFinder;
111+
this._pluginFinder = pluginFinder;
112+
this._genericAttributeService = genericAttributeService;
113+
this._dbContext = dbContext;
113114
}
114115

115116
#endregion
@@ -283,6 +284,7 @@ public ActionResult SystemInfo()
283284
{
284285
var model = new SystemInfoModel();
285286
model.AppVersion = SmartStoreVersion.CurrentFullVersion;
287+
286288
try
287289
{
288290
model.OperatingSystem = Environment.OSVersion.VersionString;
@@ -298,6 +300,7 @@ public ActionResult SystemInfo()
298300
model.IsFullTrust = AppDomain.CurrentDomain.IsFullyTrusted.ToString();
299301
}
300302
catch (Exception) { }
303+
301304
model.ServerTimeZone = TimeZone.CurrentTimeZone.StandardName;
302305
model.ServerLocalTime = DateTime.Now;
303306
model.UtcTime = DateTime.UtcNow;
@@ -307,11 +310,25 @@ public ActionResult SystemInfo()
307310
try
308311
{
309312
var mbSize = _dbContext.SqlQuery<decimal>("Select Sum(size)/128.0 From sysfiles").FirstOrDefault();
310-
311313
model.DatabaseSize = Convert.ToDouble(mbSize);
312314
}
313315
catch (Exception) { }
314316

317+
try
318+
{
319+
if (DataSettings.Current.IsValid())
320+
model.DataProviderFriendlyName = DataSettings.Current.ProviderFriendlyName;
321+
}
322+
catch (Exception) { }
323+
324+
try
325+
{
326+
var assembly = Assembly.GetExecutingAssembly();
327+
var fi = new FileInfo(assembly.Location);
328+
model.AppDate = fi.LastWriteTime.ToLocalTime();
329+
}
330+
catch (Exception) { }
331+
315332
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
316333
{
317334
model.LoadedAssemblies.Add(new SystemInfoModel.LoadedAssembly()
@@ -534,7 +551,7 @@ public ActionResult Maintenance()
534551
model.DeleteGuests.EndDate = DateTime.UtcNow.AddDays(-7);
535552
model.DeleteGuests.OnlyWithoutShoppingCart = true;
536553

537-
// image cache stats (codehint: sm-add)
554+
// image cache stats
538555
long imageCacheFileCount = 0;
539556
long imageCacheTotalSize = 0;
540557
_imageCache.CacheStatistics(out imageCacheFileCount, out imageCacheTotalSize);

src/Presentation/SmartStore.Web/Administration/Models/Common/SystemInfoModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public SystemInfoModel()
2121
[SmartResourceDisplayName("Admin.System.SystemInfo.AppVersion")]
2222
public string AppVersion { get; set; }
2323

24+
[SmartResourceDisplayName("Admin.System.SystemInfo.AppDate")]
25+
public DateTime AppDate { get; set; }
26+
2427
[SmartResourceDisplayName("Admin.System.SystemInfo.OperatingSystem")]
2528
public string OperatingSystem { get; set; }
2629

@@ -41,6 +44,16 @@ public SystemInfoModel()
4144

4245
[SmartResourceDisplayName("Admin.System.SystemInfo.DatabaseSize")]
4346
public double DatabaseSize { get; set; }
47+
public string DatabaseSizeString
48+
{
49+
get
50+
{
51+
return (DatabaseSize == 0.0 ? "" : "{0:0.00} MB".FormatWith(DatabaseSize));
52+
}
53+
}
54+
55+
[SmartResourceDisplayName("Admin.System.SystemInfo.DataProviderFriendlyName")]
56+
public string DataProviderFriendlyName { get; set; }
4457

4558
public class LoadedAssembly : ModelBase
4659
{

src/Presentation/SmartStore.Web/Administration/SmartStore.Admin.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</ProductVersion>
99
<SchemaVersion>2.0</SchemaVersion>
1010
<ProjectGuid>{152C761A-DD2E-4C1F-AF89-DFB2547A3BCA}</ProjectGuid>
11-
<ProjectTypeGuids>{E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
11+
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
1212
<OutputType>Library</OutputType>
1313
<AppDesignerFolder>Properties</AppDesignerFolder>
1414
<RootNamespace>SmartStore.Admin</RootNamespace>

src/Presentation/SmartStore.Web/Administration/Views/Common/SystemInfo.cshtml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
@Html.DisplayFor(model => model.AppVersion)
3131
</td>
3232
</tr>
33+
<tr>
34+
<td class="adminTitle">
35+
@Html.SmartLabelFor(model => model.AppDate)
36+
</td>
37+
<td class="adminData">
38+
@Model.AppDate.ToString("F")
39+
</td>
40+
</tr>
3341
<tr>
3442
<td class="adminTitle">
3543
@Html.SmartLabelFor(model => model.OperatingSystem)
@@ -86,12 +94,20 @@
8694
@Model.HttpHost
8795
</td>
8896
</tr>
97+
<tr>
98+
<td class="adminTitle">
99+
@Html.SmartLabelFor(model => model.DataProviderFriendlyName)
100+
</td>
101+
<td class="adminData">
102+
@Model.DataProviderFriendlyName.NaIfEmpty()
103+
</td>
104+
</tr>
89105
<tr>
90106
<td class="adminTitle">
91107
@Html.SmartLabelFor(model => model.DatabaseSize)
92108
</td>
93109
<td class="adminData">
94-
@("{0:0.00}".FormatWith(Model.DatabaseSize)) MB
110+
@Model.DatabaseSizeString.NaIfEmpty()
95111
</td>
96112
</tr>
97113
<tr>

0 commit comments

Comments
 (0)