Fixes: U4-3821 Infinite redirect loop when upgrading from 7.0.0 to 7.0.1 and ensures media cache is rebuilt on upgrade

This commit is contained in:
Shannon
2013-12-10 11:51:03 +11:00
parent bffe52e060
commit eaac76cdc1
9 changed files with 108 additions and 28 deletions

View File

@@ -0,0 +1,33 @@
using System;
using Umbraco.Core.Configuration;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenZeroOne
{
/// <summary>
/// Due to this bug: http://issues.umbraco.org/issue/U4-3820 we need to remove the cached media
/// xml found in the cmsContentXml table for any media that has been recycled.
/// </summary>
[Migration("7.0.1", 1, GlobalSettings.UmbracoMigrationName)]
public class RemoveCachedRecycleMediaXml : MigrationBase
{
public override void Up()
{
//now that the controlId column is renamed and now a string we need to convert
if (Context == null || Context.Database == null) return;
Execute.Code(database =>
{
var mediasvc = (MediaService) ApplicationContext.Current.Services.MediaService;
mediasvc.RebuildXmlStructures();
return string.Empty;
});
}
public override void Down()
{
}
}
}

View File

@@ -339,6 +339,7 @@
<Compile Include="Models\TaggableObjectTypes.cs" />
<Compile Include="Models\TemplateNode.cs" />
<Compile Include="Packaging\PackageBinaryInspector.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSevenZeroOne\RemoveCachedRecycleMediaXml.cs" />
<Compile Include="PropertyEditors\DefaultPropertyValueConverterAttribute.cs" />
<Compile Include="Persistence\Migrations\Upgrades\TargetVersionSeven\UpdateRelatedLinksData.cs" />
<Compile Include="PropertyEditors\IValueEditor.cs" />

View File

@@ -336,29 +336,29 @@ namespace Umbraco.Tests
var types = PluginManager.Current.ResolveXsltExtensions();
Assert.AreEqual(3, types.Count());
}
///// <summary>
///// This demonstrates this issue: http://issues.umbraco.org/issue/U4-3505 - the TypeList was returning a list of assignable types
///// not explicit types which is sort of ideal but is confusing so we'll do it the less confusing way.
///// </summary>
//[Test]
//public void TypeList_Resolves_Explicit_Types()
//{
// var types = new HashSet<PluginManager.TypeList>();
// var propEditors = new PluginManager.TypeList<PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes);
// propEditors.AddType(typeof (LabelPropertyEditor));
// types.Add(propEditors);
/// <summary>
/// This demonstrates this issue: http://issues.umbraco.org/issue/U4-3505 - the TypeList was returning a list of assignable types
/// not explicit types which is sort of ideal but is confusing so we'll do it the less confusing way.
/// </summary>
[Test]
public void TypeList_Resolves_Explicit_Types()
{
var types = new HashSet<PluginManager.TypeList>();
// var found = types.SingleOrDefault(x => x.IsTypeList<PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes));
var propEditors = new PluginManager.TypeList<PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes);
propEditors.AddType(typeof(LabelPropertyEditor));
types.Add(propEditors);
// Assert.IsNotNull(found);
var found = types.SingleOrDefault(x => x.IsTypeList<PropertyEditor>(PluginManager.TypeResolutionKind.FindAllTypes));
// //This should not find a type list of this type
// var shouldNotFind = types.SingleOrDefault(x => x.IsTypeList<IParameterEditor>(PluginManager.TypeResolutionKind.FindAllTypes));
Assert.IsNotNull(found);
// Assert.IsNull(shouldNotFind);
//}
//This should not find a type list of this type
var shouldNotFind = types.SingleOrDefault(x => x.IsTypeList<IParameterEditor>(PluginManager.TypeResolutionKind.FindAllTypes));
Assert.IsNull(shouldNotFind);
}
[XsltExtension("Blah.Blah")]
public class MyXsltExtension

View File

@@ -0,0 +1,32 @@
/**
* @ngdoc controller
* @name Umbraco.MainController
* @function
*
* @description
* The controller for the AuthorizeUpgrade login page
*
*/
function AuthorizeUpgradeController($scope, $window) {
//Add this method to the scope - this method will be called by the login dialog controller when the login is successful
// then we'll handle the redirect.
$scope.submit = function (event) {
var qry = $window.location.search.trimStart("?").split("&");
var redir = _.find(qry, function(item) {
return item.startsWith("redir=");
});
if (redir) {
$window.location = decodeURIComponent(redir.split("=")[1]);
}
else {
$window.location = "/";
}
};
}
angular.module('umbraco').controller("Umbraco.AuthorizeUpgradeController", AuthorizeUpgradeController);

View File

@@ -35,7 +35,7 @@
userService.authenticate(login, password)
.then(function (data) {
$scope.submit(true);
$scope.submit(true);
}, function (reason) {
$scope.errorMsg = reason.errorMsg;

View File

@@ -2157,6 +2157,7 @@
<Content Include="Umbraco\PartialViews\Templates\MultinodeTree-picker.cshtml" />
<Content Include="Umbraco\PartialViews\Templates\Navigation.cshtml" />
<Content Include="Umbraco\PartialViews\Templates\SiteMap.cshtml" />
<Content Include="Umbraco\Views\AuthorizeUpgrade.cshtml" />
<None Include="Umbraco_client\CodeMirror\js\mode\coffeescript\LICENSE" />
<None Include="Umbraco_client\CodeMirror\js\mode\pascal\LICENSE" />
<None Include="Umbraco_client\CodeMirror\js\mode\perl\LICENSE" />
@@ -2605,7 +2606,7 @@
<Folder Include="Views\Partials\" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
@@ -2623,9 +2624,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7010</DevelopmentServerPort>
<DevelopmentServerPort>7000</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7010</IISUrl>
<IISUrl>http://localhost:7000</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>

View File

@@ -10,7 +10,7 @@ NOTES:
* Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config
* A new version will invalidate both client and server cache and create new persisted files
-->
<clientDependency version="29" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
<clientDependency version="30" fileDependencyExtensions=".js,.css" loggerType="Umbraco.Web.UI.CdfLogger, umbraco">
<!--
This section is used for Web Forms only, the enableCompositeFiles="true" is optional and by default is set to true.

View File

@@ -64,12 +64,14 @@ namespace Umbraco.Web.UI.Install
if (string.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus) == false)
{
var result = Security.ValidateCurrentUser(false);
if (result == ValidateRequestAttempt.FailedTimedOut || result == ValidateRequestAttempt.FailedNoPrivileges)
switch (result)
{
Response.Redirect(
//We must add the token to prevent CSRF attacks since the logout occurs on a GET not a POST
SystemDirectories.Umbraco + "/logout.aspx?redir=" + Server.UrlEncode(Request.RawUrl) + "&t=" + Security.GetSessionId());
case ValidateRequestAttempt.FailedNoPrivileges:
case ValidateRequestAttempt.FailedTimedOut:
case ValidateRequestAttempt.FailedNoContextId:
Response.Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl));
break;
}
}

View File

@@ -35,6 +35,17 @@ namespace Umbraco.Web.Editors
return View(GlobalSettings.Path.EnsureEndsWith('/') + "Views/Default.cshtml");
}
/// <summary>
/// This Action is used by the installer when an upgrade is detected but the admin user is not logged in. We need to
/// ensure the user is authenticated before the install takes place so we redirect here to show the standard login screen.
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult AuthorizeUpgrade()
{
return View(GlobalSettings.Path.EnsureEndsWith('/') + "Views/AuthorizeUpgrade.cshtml");
}
/// <summary>
/// Returns the JavaScript main file including all references found in manifests
/// </summary>