protected void Application_End(object sender, EventArgs e) { if (SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted) { LogHelper.Info <UmbracoApplicationBase>("Application shutdown. Reason: " + HostingEnvironment.ShutdownReason); } OnApplicationEnd(sender, e); }
protected void Application_End(object sender, EventArgs e) { if (SystemUtilities.GetCurrentTrustLevel() == AspNetHostingPermissionLevel.Unrestricted) { //Try to log the detailed shutdown message (typical asp.net hack: http://weblogs.asp.net/scottgu/433194) try { var runtime = (HttpRuntime)typeof(HttpRuntime).InvokeMember("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null); if (runtime == null) { return; } var shutDownMessage = (string)runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); var shutDownStack = (string)runtime.GetType().InvokeMember("_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); var shutdownMsg = string.Format("{0}\r\n\r\n_shutDownMessage={1}\r\n\r\n_shutDownStack={2}", HostingEnvironment.ShutdownReason, shutDownMessage, shutDownStack); Logger.Info <UmbracoApplicationBase>("Application shutdown. Details: " + shutdownMsg); } catch (Exception) { //if for some reason that fails, then log the normal output Logger.Info <UmbracoApplicationBase>("Application shutdown. Reason: " + HostingEnvironment.ShutdownReason); } } OnApplicationEnd(sender, e); //Last thing to do is shutdown log4net LogManager.Shutdown(); }
/* * private string GetResultMessageForMySql(bool? supportsCaseInsensitiveQueries) * { * if (supportsCaseInsensitiveQueries == null) * { * return "<p> </p><p>Warning! Could not check if your database type supports case insensitive queries. <br />We currently do not support these databases that do not support case insensitive queries.</p>" + * "<p>You can check this by looking for the following setting in your my.ini file in your MySQL installation directory:</p>" + * "<pre>lower_case_table_names=1</pre><br />" + * "<p>Note: Make sure to check with your hosting provider if they support case insensitive queries as well.</p>" + * "<p>For more technical information on case sensitivity in MySQL, have a look at " + * "<a href='http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html'>the documentation on the subject</a></p>"; * } * if (SqlSyntax.GetType() == typeof(MySqlSyntaxProvider)) * { * return "<p> </p><p>Congratulations, the database step ran successfully!</p>" + * "<p>Note: You're using MySQL and the database instance you're connecting to seems to support case insensitive queries.</p>" + * "<p>However, your hosting provider may not support this option. Umbraco does not currently support MySQL installs that do not support case insensitive queries</p>" + * "<p>Make sure to check with your hosting provider if they support case insensitive queries as well.</p>" + * "<p>They can check this by looking for the following setting in the my.ini file in their MySQL installation directory:</p>" + * "<pre>lower_case_table_names=1</pre><br />" + * "<p>For more technical information on case sensitivity in MySQL, have a look at " + * "<a href='http://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html'>the documentation on the subject</a></p>"; * } * return string.Empty; * }*/ private Attempt <Result> CheckReadyForInstall() { if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted && ProviderName == Constants.DatabaseProviders.MySql) { throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration"); } if (_configured == false || (string.IsNullOrEmpty(_connectionString) || string.IsNullOrEmpty(ProviderName))) { return(Attempt.Fail(new Result { Message = "Database configuration is invalid. Please check that the entered database exists and that the provided username and password has write access to the database.", Success = false, Percentage = "10" })); } return(Attempt <Result> .Succeed()); }
internal DatabaseSchemaResult ValidateDatabaseSchema() { if (_configured == false || (string.IsNullOrEmpty(_connectionString) || string.IsNullOrEmpty(ProviderName))) { return(new DatabaseSchemaResult()); } if (_result == null) { if (SystemUtilities.GetCurrentTrustLevel() != AspNetHostingPermissionLevel.Unrestricted && ProviderName == Constants.DatabaseProviders.MySql) { throw new InvalidOperationException("Cannot use MySql in Medium Trust configuration"); } var database = new UmbracoDatabase(_connectionString, ProviderName, _logger); var dbSchema = new DatabaseSchemaCreation(database, _logger, SqlSyntax); _result = dbSchema.ValidateSchema(); } return(_result); }