mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Removed cache from data migration notifier
--HG-- branch : dev
This commit is contained in:
parent
b3b48fa3df
commit
b86d3e20ed
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Data.Migration.Interpreters;
|
||||
using Orchard.Data.Migration.Records;
|
||||
using Orchard.Data.Migration.Schema;
|
||||
@ -20,20 +19,17 @@ namespace Orchard.Data.Migration {
|
||||
private readonly IRepository<DataMigrationRecord> _dataMigrationRepository;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly IDataMigrationInterpreter _interpreter;
|
||||
private readonly ISignals _signals;
|
||||
|
||||
public DataMigrationManager(
|
||||
IEnumerable<IDataMigration> dataMigrations,
|
||||
IRepository<DataMigrationRecord> dataMigrationRepository,
|
||||
IExtensionManager extensionManager,
|
||||
IDataMigrationInterpreter interpreter,
|
||||
ISignals signals
|
||||
IDataMigrationInterpreter interpreter
|
||||
) {
|
||||
_dataMigrations = dataMigrations;
|
||||
_dataMigrationRepository = dataMigrationRepository;
|
||||
_extensionManager = extensionManager;
|
||||
_interpreter = interpreter;
|
||||
_signals = signals;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@ -82,9 +78,6 @@ namespace Orchard.Data.Migration {
|
||||
}
|
||||
|
||||
public void Update(string feature){
|
||||
// invalidate the notifications cache
|
||||
_signals.Trigger(DataMigrationNotificationProvider.SignalKey);
|
||||
|
||||
Logger.Information("Updating {0}", feature);
|
||||
|
||||
// proceed with dependent features first, whatever the module it's in
|
||||
@ -152,9 +145,6 @@ namespace Orchard.Data.Migration {
|
||||
}
|
||||
|
||||
public void Uninstall(string feature) {
|
||||
// invalidate the notifications cache
|
||||
_signals.Trigger(DataMigrationNotificationProvider.SignalKey);
|
||||
|
||||
var migrations = GetDataMigrations(feature);
|
||||
|
||||
// apply update methods to each migration class for the module
|
||||
|
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
using Orchard.UI.Notify;
|
||||
@ -9,25 +8,16 @@ using Orchard.UI.Notify;
|
||||
namespace Orchard.Data.Migration {
|
||||
public class DataMigrationNotificationProvider: INotificationProvider {
|
||||
private readonly IDataMigrationManager _dataMigrationManager;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private readonly ISignals _signals;
|
||||
public const string CacheKey = "DataMigrationNotifications";
|
||||
public const string SignalKey = "DataMigrationNotificationsChanged";
|
||||
|
||||
public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager, ICacheManager cacheManager, ISignals signals) {
|
||||
public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager) {
|
||||
_dataMigrationManager = dataMigrationManager;
|
||||
_cacheManager = cacheManager;
|
||||
_signals = signals;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<NotifyEntry> GetNotifications() {
|
||||
var features = _cacheManager.Get(CacheKey, ctx => {
|
||||
ctx.Monitor(_signals.When(SignalKey));
|
||||
return _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
});
|
||||
var features = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
|
||||
if(features.Any()) {
|
||||
yield return new NotifyEntry { Message = T("Some features need to be upgraded: {0}", String.Join(", ", features)), Type = NotifyType.Warning};
|
||||
|
Loading…
Reference in New Issue
Block a user