mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Fixing update feature functionality.
This fixes an issue when for some reason a migration update step fails and the user wants to try again, but the migrations aren't executed for the selected features.
This commit is contained in:
@@ -221,7 +221,10 @@ namespace Orchard.Modules.Controllers {
|
||||
_moduleService.DisableFeatures(enabledFeatures, force == true);
|
||||
break;
|
||||
case FeaturesBulkAction.Update:
|
||||
foreach (var feature in selectedFeatures.Where(x => x.NeedsUpdate)) {
|
||||
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
var selectedFeaturesThatNeedUpdate = selectedFeatures.Where(x => featuresThatNeedUpdate.Contains(x.Descriptor.Id));
|
||||
|
||||
foreach (var feature in selectedFeaturesThatNeedUpdate) {
|
||||
var id = feature.Descriptor.Id;
|
||||
try {
|
||||
_reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation");
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.None, T("Choose action...").ToString())
|
||||
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Enable, T("Enable").ToString())
|
||||
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Disable, T("Disable").ToString())
|
||||
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Update, T("Update").ToString())
|
||||
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Toggle, T("Toggle").ToString())
|
||||
</select>
|
||||
<button type="submit" name="submit.BulkExecute" value="yes">@T("Execute")</button>
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Orchard.Data.Migration {
|
||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||
private readonly ITransactionManager _transactionManager;
|
||||
|
||||
private List<string> _processedFeatures;
|
||||
private readonly List<string> _processedFeatures;
|
||||
|
||||
public DataMigrationManager(
|
||||
IEnumerable<IDataMigration> dataMigrations,
|
||||
@@ -118,11 +118,11 @@ namespace Orchard.Data.Migration {
|
||||
|
||||
while (lookupTable.ContainsKey(current)) {
|
||||
try {
|
||||
Logger.Information("Applying migration for {0} from version {1}", feature, current);
|
||||
Logger.Information("Applying migration for {0} from version {1}.", feature, current);
|
||||
current = (int)lookupTable[current].Invoke(migration, new object[0]);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
Logger.Error(ex, "An unexpected error occurred while applying migration on {0} from version {1}", feature, current);
|
||||
Logger.Error(ex, "An unexpected error occurred while applying migration on {0} from version {1}.", feature, current);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -139,15 +139,16 @@ namespace Orchard.Data.Migration {
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Logger.Error(e, "Error while running migration version {0} for {1}", current, feature);
|
||||
Logger.Error(e, "Error while running migration version {0} for {1}.", current, feature);
|
||||
_transactionManager.Cancel();
|
||||
throw new OrchardException(T("Error while running migration version {0} for {1}.", current, feature), e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void Uninstall(string feature) {
|
||||
Logger.Information("Uninstalling feature: {0}", feature);
|
||||
Logger.Information("Uninstalling feature: {0}.", feature);
|
||||
|
||||
var migrations = GetDataMigrations(feature);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user