mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#18585: Preventing some expected errors from being logged during setup
Work Item: 18585 --HG-- branch : 1.x
This commit is contained in:
@@ -108,21 +108,17 @@ namespace Orchard.Setup.Services {
|
||||
var shellBlueprint = _compositionStrategy.Compose(shellSettings, shellDescriptor);
|
||||
|
||||
// initialize database explicitly, and store shell descriptor
|
||||
using (var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellBlueprint))
|
||||
{
|
||||
using (var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellBlueprint)) {
|
||||
|
||||
using (var environment = bootstrapLifetimeScope.CreateWorkContextScope())
|
||||
{
|
||||
using (var environment = bootstrapLifetimeScope.CreateWorkContextScope()) {
|
||||
|
||||
// check if the database is already created (in case an exception occured in the second phase)
|
||||
var shellDescriptorRepository = environment.Resolve<IRepository<ShellDescriptorRecord>>();
|
||||
try
|
||||
{
|
||||
shellDescriptorRepository.Get(x => true);
|
||||
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>());
|
||||
try {
|
||||
var tablePrefix = String.IsNullOrEmpty(_shellSettings.DataTablePrefix) ? "" : _shellSettings.DataTablePrefix + "_";
|
||||
schemaBuilder.ExecuteSql("SELECT * FROM " + tablePrefix + "Settings_ShellDescriptorRecord");
|
||||
}
|
||||
catch
|
||||
{
|
||||
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>());
|
||||
catch {
|
||||
var reportsCoordinator = environment.Resolve<IReportsCoordinator>();
|
||||
|
||||
reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation");
|
||||
@@ -136,8 +132,7 @@ namespace Orchard.Setup.Services {
|
||||
var dataMigrationManager = environment.Resolve<IDataMigrationManager>();
|
||||
dataMigrationManager.Update("Settings");
|
||||
|
||||
foreach (var feature in context.EnabledFeatures)
|
||||
{
|
||||
foreach (var feature in context.EnabledFeatures) {
|
||||
dataMigrationManager.Update(feature);
|
||||
}
|
||||
|
||||
|
@@ -339,17 +339,20 @@ namespace Orchard.Data.Migration.Interpreters {
|
||||
var session = _sessionLocator.For(typeof(ContentItemRecord));
|
||||
var connection = session.Connection;
|
||||
|
||||
foreach (var sqlStatement in _sqlStatements) {
|
||||
Logger.Debug(sqlStatement);
|
||||
using (var command = connection.CreateCommand()) {
|
||||
command.CommandText = sqlStatement;
|
||||
command.ExecuteNonQuery();
|
||||
try {
|
||||
foreach (var sqlStatement in _sqlStatements) {
|
||||
Logger.Debug(sqlStatement);
|
||||
using (var command = connection.CreateCommand()) {
|
||||
command.CommandText = sqlStatement;
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
_reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement));
|
||||
}
|
||||
|
||||
_reportsCoordinator.Information("Data Migration", String.Format("Executing SQL Query: {0}", sqlStatement));
|
||||
}
|
||||
|
||||
_sqlStatements.Clear();
|
||||
finally {
|
||||
_sqlStatements.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
private bool ExecuteCustomInterpreter<T>(T command) where T : ISchemaBuilderCommand {
|
||||
|
@@ -96,7 +96,7 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
}
|
||||
|
||||
public ShellContext CreateSetupContext(ShellSettings settings) {
|
||||
Logger.Warning("No shell settings available. Creating shell context for setup");
|
||||
Logger.Debug("No shell settings available. Creating shell context for setup");
|
||||
|
||||
var descriptor = new ShellDescriptor {
|
||||
SerialNumber = -1,
|
||||
|
Reference in New Issue
Block a user