Fixes installer issue: Saving web.config & storing static reference to connection string (27210)

[TFS Changeset #66315]
This commit is contained in:
Shandem
2010-05-28 01:44:10 +00:00
parent 0a02daf983
commit 70975a98b7
12 changed files with 103 additions and 52 deletions

10
SHOCKING.testrunconfig Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<TestRunConfiguration name="SHOCKING" id="0317effe-25fb-4c40-99c3-8529bdb6b284" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>This is a default test run configuration for a local test run.</Description>
<Hosts type="ASP.NET" skipUnhostableTests="false">
<AspNet name="ASP.NET" executionType="WebDev" urlToTest="http://localhost:59454/">
<DevelopmentServer pathToWebSite="D:\~CODEPLEXPROJECTS\Umbraco\branches\4.1\umbraco\presentation" webApplicationRoot="/" />
</AspNet>
</Hosts>
<TestTypeSpecific />
</TestRunConfiguration>

View File

@@ -5,6 +5,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.xml = build.xml
default.build = default.build
SHANDEMVAIO.testrunconfig = SHANDEMVAIO.testrunconfig
SHOCKING.testrunconfig = SHOCKING.testrunconfig
umbraco weekly.build = umbraco weekly.build
umbraco.build = umbraco.build
umbraco.vsmdi = umbraco.vsmdi
@@ -16,6 +17,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StandardConfig", "StandardC
aspnet35.config = aspnet35.config
config templates\config\UI.xml = config templates\config\UI.xml
config templates\umbraco.config = config templates\umbraco.config
config templates\config\umbracoSettings.config = config templates\config\umbracoSettings.config
config templates\config\UrlRewriting.config = config templates\config\UrlRewriting.config
config templates\web.config = config templates\web.config
EndProjectSection
EndProject

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
<RunConfiguration id="338122db-6049-471e-b697-cbaf25469edc" name="Local Test Run" storage="localtestrun.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, PublicKeyToken=b03f5f7f11d50a3a" />
<RunConfiguration id="0317effe-25fb-4c40-99c3-8529bdb6b284" name="SHOCKING" storage="shocking.testrunconfig" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</TestList>
</TestLists>

View File

@@ -15,14 +15,12 @@ namespace umbraco.BusinessLogic
/// </summary>
public class Application
{
//Applications found through reflection
/// <summary>
/// Applications found through reflection
/// </summary>
private static readonly List<IApplication> _applications = new List<IApplication>();
private static string _ConnString = GlobalSettings.DbDSN;
private static ISqlHelper _sqlHelper;
/*Use this declaration to log SQL queries:
private static ISqlHelper _sqlHelper= new SqlHelperExtender(
DataLayerHelper.CreateSqlHelper(_ConnString),
new Logger(@"c:\temp\sql.log"));*/
private static ISqlHelper _sqlHelper;
private const string CACHE_KEY = "ApplicationCache";
@@ -32,7 +30,7 @@ namespace umbraco.BusinessLogic
private static List<Application> Apps
{
get
{
{
//ensure cache exists
if (HttpRuntime.Cache[CACHE_KEY] == null)
ReCache();
@@ -61,7 +59,7 @@ namespace umbraco.BusinessLogic
{
try
{
_sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString);
_sqlHelper = DataLayerHelper.CreateSqlHelper(GlobalSettings.DbDSN);
}
catch { }
}

View File

@@ -151,7 +151,9 @@ namespace umbraco
set
{
if (DbDSN != value)
{
SaveSetting("umbracoDbDSN", value);
}
}
}
@@ -245,26 +247,19 @@ namespace umbraco
protected static void SaveSetting(string key, string value)
{
WebConfigurationFileMap webConfig = new WebConfigurationFileMap();
var vDirs = webConfig.VirtualDirectories;
var vDir = "~";
foreach (VirtualDirectoryMapping v in webConfig.VirtualDirectories)
{
if (v.IsAppRoot)
{
Configuration config = WebConfigurationManager.OpenWebConfiguration(v.VirtualDirectory);
config.AppSettings.Settings[key].Value = value;
config.Save();
ConfigurationManager.RefreshSection("appSettings");
break;
vDir = v.VirtualDirectory;
}
}
//ExeConfigurationFileMap webConfig = new ExeConfigurationFileMap();
//webConfig.ExeConfigFilename = FullpathToRoot + "web.config";
//Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
/* Configuration config =
ConfigurationManager.OpenMappedExeConfiguration(webConfig, ConfigurationUserLevel.None);
*/
Configuration config = WebConfigurationManager.OpenWebConfiguration(vDir);
config.AppSettings.Settings[key].Value = value;
config.Save();
ConfigurationManager.RefreshSection("appSettings");
}
/// <summary>

View File

@@ -0,0 +1,2 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Title.ascx.cs" Inherits="umbraco.presentation.install.Title" %>
<title>Umbraco <%=umbraco.GlobalSettings.CurrentVersion%> Configuration Wizard</title>

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace umbraco.presentation.install
{
public partial class Title : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}

View File

@@ -0,0 +1,17 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace umbraco.presentation.install
{
public partial class Title
{
}
}

View File

@@ -1,12 +1,14 @@
<%@ Page Language="c#" CodeBehind="default.aspx.cs" AutoEventWireup="True" Inherits="umbraco.presentation.install._default" EnableViewState="False" %>
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<%@ Register Src="~/install/Title.ascx" TagPrefix="umb1" TagName="PageTitle" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Umbraco <%=umbraco.GlobalSettings.CurrentVersion%> Configuration Wizard</title>
<umb1:PageTitle runat="server" />
<style type="text/css">
#generatedCategories{display: none;}
#list1a{height: 300px; overflow: auto;}
@@ -22,41 +24,41 @@
</style>
</head>
<body>
<script type="text/javascript">
function nextStep(button, elementId) {
function nextStep(button, elementId) {
showProgress(button, elementId);
setTimeout('document.location.href = \'default.aspx?installStep=' + document.getElementById("step").value + '\'', 100);
}
}
function showProgress(button, elementId) {
function showProgress(button, elementId) {
var img = document.getElementById(elementId);
img.style.visibility = "visible";
button.style.display = "none";
}
}
function InstallPackages(button, elementId) {
function InstallPackages(button, elementId) {
var next = document.getElementById('<%= next.ClientID %>');
next.style.display = "none";
showProgress(button, elementId);
}
function toggleModules() {
document.getElementById("generatedCategories").style.display = "block";
}
function openDemoModal(id, name) {
UmbClientMgr.openModalWindow("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, name, true, 750, 550)
showProgress(button, elementId);
}
function toggleModules() {
document.getElementById("generatedCategories").style.display = "block";
}
function openDemoModal(id, name) {
UmbClientMgr.openModalWindow("http://packages.umbraco.org/viewPackageData.aspx?id=" + id, name, true, 750, 550)
return false;
}
}
</script>
</head>
<body>
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" ProviderName="LazyLoadProvider" />
<cc1:UmbracoClientDependencyLoader runat="server" id="ClientLoader" />
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="style.css" />
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="modal/style.css" PathNameAlias="UmbracoClient" />

View File

@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4927
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

View File

@@ -295,6 +295,13 @@
<Compile Include="install\steps\welcome.ascx.designer.cs">
<DependentUpon>welcome.ascx</DependentUpon>
</Compile>
<Compile Include="install\Title.ascx.cs">
<DependentUpon>Title.ascx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="install\Title.ascx.designer.cs">
<DependentUpon>Title.ascx</DependentUpon>
</Compile>
<Compile Include="item.cs">
<SubType>Code</SubType>
</Compile>
@@ -1489,6 +1496,7 @@
<Content Include="config\splashes\booting.aspx" />
<Content Include="config\splashes\noNodes.aspx" />
<Content Include="config\splashes\worker.png" />
<Content Include="install\Title.ascx" />
<Content Include="web.config.Az-VAIO.xslt" />
<Content Include="umbraco\endPreview.aspx" />
<Content Include="umbraco\js\UmbracoCasingRules.aspx" />

View File

@@ -4,19 +4,19 @@
<!-- Set up a local connection string -->
<xsl:template match="/configuration/appSettings/add[@key='umbracoDbDSN']/@value">
<xsl:attribute name="value">server=SHOCKING\SQLEXPRESS;database=UmbracoTest2;user id=sa;password=test</xsl:attribute>
<xsl:attribute name="value">server=SHOCKING\SQLEXPRESS;database=UmbracoTest5;user id=sa;password=test</xsl:attribute>
</xsl:template>
<xsl:template match="/configuration/appSettings/add[@key='umbracoConfigurationStatus']/@value">
<xsl:attribute name="value">4.1.0.beta</xsl:attribute>
<xsl:attribute name="value">4.1.0.betaII</xsl:attribute>
</xsl:template>
<xsl:template match="/configuration/appSettings/add[@key='umbracoContentXML']/@value">
<xsl:attribute name="value">/App_Data/umbraco.config</xsl:attribute>
<xsl:attribute name="value">~/App_Data/umbraco.config</xsl:attribute>
</xsl:template>
<xsl:template match="/configuration/appSettings/add[@key='umbracoPath']/@value">
<xsl:attribute name="value">/umbraco</xsl:attribute>
<xsl:attribute name="value">~/umbraco</xsl:attribute>
</xsl:template>
<!-- Add trace output -->