Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 389b29599b | |||
| f816a63b54 | |||
| fa8f3985b8 | |||
| 175c785705 | |||
| 72aebd3ecf | |||
| 802cbb82c4 | |||
| 42f5507fe8 | |||
| 5a8e37f5b4 | |||
| 3c7d3b2f63 | |||
| d598fdce54 | |||
| 32892cf5e0 | |||
| 882d5ec7f5 | |||
| ce69497a68 | |||
| 1d43cf491b | |||
| 27283754c0 | |||
| 5b2212829c | |||
| 546209ddb5 | |||
| 54bda6f12a | |||
| 690af8e494 | |||
| 9d06ce53a4 |
@@ -33,8 +33,8 @@
|
||||
<dependency id="AutoMapper" version="[3.3.1, 4.0.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[6.0.8, 10.0.0)" />
|
||||
<dependency id="Examine" version="[0.1.80, 1.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[2.5.1, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[4.8.0, 5.0.0)" />
|
||||
<dependency id="ImageProcessor" version="[2.5.2, 3.0.0)" />
|
||||
<dependency id="ImageProcessor.Web" version="[4.8.2, 5.0.0)" />
|
||||
<dependency id="semver" version="[1.1.2, 2.0.0)" />
|
||||
<dependency id="UrlRewritingNet" version="[2.0.7, 3.0.0)" />
|
||||
<!-- Markdown can not be updated due to: https://github.com/hey-red/markdownsharp/issues/71#issuecomment-233585487 -->
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
<file src="tools\umbracoSettings.config.install.xdt" target="Content\config\umbracoSettings.config.install.xdt" />
|
||||
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
|
||||
<file src="tools\processing.config.install.xdt" target="Content\Config\imageprocessor\processing.config.install.xdt" />
|
||||
<file src="tools\cache.config.install.xdt" target="Content\Config\imageprocessor\cache.config.install.xdt" />
|
||||
<file src="build\**" target="build" />
|
||||
</files>
|
||||
</package>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0"?>
|
||||
<caching xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<caches>
|
||||
<cache name="DiskCache" trimCache="false" xdt:Transform="SetAttributes(trimCache)" xdt:Locator="Match(name)" />
|
||||
</caches>
|
||||
</caching>
|
||||
@@ -49,8 +49,9 @@
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ImageProcessor, Version=2.5.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll</HintPath>
|
||||
<Reference Include="ImageProcessor, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\log4net-mediumtrust.2.0.0\lib\log4net.dll</HintPath>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
|
||||
<package id="ImageProcessor" version="2.5.1" targetFramework="net45" />
|
||||
<package id="ImageProcessor" version="2.5.2" targetFramework="net45" />
|
||||
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Identity.Core" version="2.2.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Identity.Owin" version="2.2.1" targetFramework="net45" />
|
||||
|
||||
@@ -57,9 +57,8 @@
|
||||
<Reference Include="AutoMapper.Net4, Version=3.3.1.0, Culture=neutral, PublicKeyToken=be96cd2c38ef1005, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.Net4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Examine, Version=0.1.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.80\lib\net45\Examine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="AspNetWebApi.SelfHost" version="4.0.20710.0" targetFramework="net45" />
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.80" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.81" targetFramework="net45" />
|
||||
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
|
||||
|
||||
@@ -204,7 +204,7 @@ angular.module('umbraco.services')
|
||||
//when it's successful, return the user data
|
||||
setCurrentUser(data);
|
||||
|
||||
var result = { user: data, authenticated: true, lastUserId: lastUserId };
|
||||
var result = { user: data, authenticated: true, lastUserId: lastUserId, loginType: "credentials" };
|
||||
|
||||
//broadcast a global event
|
||||
eventsService.emit("app.authenticated", result);
|
||||
@@ -232,7 +232,7 @@ angular.module('umbraco.services')
|
||||
authResource.getCurrentUser()
|
||||
.then(function (data) {
|
||||
|
||||
var result = { user: data, authenticated: true, lastUserId: lastUserId };
|
||||
var result = { user: data, authenticated: true, lastUserId: lastUserId, loginType: "implicit" };
|
||||
|
||||
//TODO: This is a mega backwards compatibility hack... These variables SHOULD NOT exist in the server variables
|
||||
// since they are not supposed to be dynamic but I accidentally added them there in 7.1.5 IIRC so some people might
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* The main application controller
|
||||
*
|
||||
*/
|
||||
function MainController($scope, $rootScope, $location, $routeParams, $timeout, $http, $log, appState, treeService, notificationsService, userService, navigationService, historyService, updateChecker, assetsService, eventsService, umbRequestHelper, tmhDynamicLocale) {
|
||||
function MainController($scope, $rootScope, $location, $routeParams, $timeout, $http, $log, appState, treeService, notificationsService, userService, navigationService, historyService, updateChecker, assetsService, eventsService, umbRequestHelper, tmhDynamicLocale, localStorageService) {
|
||||
|
||||
//the null is important because we do an explicit bool check on this in the view
|
||||
//the avatar is by default the umbraco logo
|
||||
@@ -81,6 +81,14 @@ function MainController($scope, $rootScope, $location, $routeParams, $timeout, $
|
||||
$location.path("/").search("");
|
||||
historyService.removeAll();
|
||||
treeService.clearCache();
|
||||
|
||||
//if the user changed, clearout local storage too - could contain sensitive data
|
||||
localStorageService.clearAll();
|
||||
}
|
||||
|
||||
//if this is a new login (i.e. the user entered credentials), then clear out local storage - could contain sensitive data
|
||||
if (data.loginType === "credentials") {
|
||||
localStorageService.clearAll();
|
||||
}
|
||||
|
||||
//Load locale file
|
||||
|
||||
@@ -13,11 +13,7 @@ app.run(['userService', '$log', '$rootScope', '$location', 'navigationService',
|
||||
|
||||
/** Listens for authentication and checks if our required assets are loaded, if/once they are we'll broadcast a ready event */
|
||||
eventsService.on("app.authenticated", function(evt, data) {
|
||||
|
||||
//Removes all stored LocalStorage browser items - that may contain sensitive data
|
||||
//So if a machine or computer is shared and a new user logs in, we clear out the previous persons localStorage items
|
||||
localStorageService.clearAll();
|
||||
|
||||
|
||||
assetsService._loadInitAssets().then(function() {
|
||||
appState.setGlobalState("isReady", true);
|
||||
|
||||
|
||||
@@ -127,19 +127,19 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\dotless.1.4.1.0\lib\dotless.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Examine, Version=0.1.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.80\lib\net45\Examine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ImageProcessor, Version=2.5.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.2.5.1\lib\net45\ImageProcessor.dll</HintPath>
|
||||
<Reference Include="ImageProcessor, Version=2.5.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.2.5.2\lib\net45\ImageProcessor.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ImageProcessor.Web, Version=4.8.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.Web.4.8.0\lib\net45\ImageProcessor.Web.dll</HintPath>
|
||||
<Reference Include="ImageProcessor.Web, Version=4.8.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\ImageProcessor.Web.4.8.2\lib\net45\ImageProcessor.Web.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="log4net, Version=1.2.11.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
@@ -168,7 +168,8 @@
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.IO.RecyclableMemoryStream, Version=1.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.1\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Owin">
|
||||
<HintPath>..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll</HintPath>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<caching currentCache="DiskCache">
|
||||
<caches>
|
||||
<cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="365" browserMaxDays="7">
|
||||
<cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="365" browserMaxDays="7" trimCache="false">
|
||||
<settings>
|
||||
<setting key="VirtualCachePath" value="~/app_data/cache" />
|
||||
</settings>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
<package id="ClientDependency" version="1.9.2" targetFramework="net45" />
|
||||
<package id="ClientDependency-Mvc5" version="1.8.0.0" targetFramework="net45" />
|
||||
<package id="dotless" version="1.4.1.0" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.80" targetFramework="net45" />
|
||||
<package id="ImageProcessor" version="2.5.1" targetFramework="net45" />
|
||||
<package id="ImageProcessor.Web" version="4.8.0" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.81" targetFramework="net45" />
|
||||
<package id="ImageProcessor" version="2.5.2" targetFramework="net45" />
|
||||
<package id="ImageProcessor.Web" version="4.8.2" targetFramework="net45" />
|
||||
<package id="ImageProcessor.Web.Config" version="2.3.0" targetFramework="net45" />
|
||||
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net45" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
@@ -22,7 +22,7 @@
|
||||
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.CodeAnalysis.Common" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.0" targetFramework="net45" />
|
||||
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.2.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
|
||||
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Umbraco.Web.Cache
|
||||
public override void Remove(int id)
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearPartialViewCache();
|
||||
content.Instance.ClearDocumentCache(id);
|
||||
content.Instance.ClearDocumentCache(id, false);
|
||||
DistributedCache.Instance.ClearAllMacroCacheOnCurrentServer();
|
||||
DistributedCache.Instance.ClearXsltCacheOnCurrentServer();
|
||||
ClearAllIsolatedCacheByEntityType<PublicAccessEntry>();
|
||||
@@ -95,7 +95,7 @@ namespace Umbraco.Web.Cache
|
||||
public override void Remove(IContent instance)
|
||||
{
|
||||
ApplicationContext.Current.ApplicationCache.ClearPartialViewCache();
|
||||
content.Instance.ClearDocumentCache(new Document(instance));
|
||||
content.Instance.ClearDocumentCache(new Document(instance), false);
|
||||
XmlPublishedContent.ClearRequest();
|
||||
DistributedCache.Instance.ClearAllMacroCacheOnCurrentServer();
|
||||
DistributedCache.Instance.ClearXsltCacheOnCurrentServer();
|
||||
|
||||
@@ -4,21 +4,26 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
using System.Web.SessionState;
|
||||
using AutoMapper;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using umbraco;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
/// <summary>
|
||||
/// API controller to deal with Macro data
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that this implements IRequiresSessionState which will enable HttpContext.Session - generally speaking we don't normally
|
||||
/// enable this for webapi controllers, however since this controller is used to render macro content and macros can access
|
||||
/// Session, we don't want it to throw null reference exceptions.
|
||||
/// </remarks>
|
||||
[PluginController("UmbracoApi")]
|
||||
public class MacroController : UmbracoAuthorizedJsonController
|
||||
public class MacroController : UmbracoAuthorizedJsonController, IRequiresSessionState
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the macro parameters to be filled in for a particular macro
|
||||
/// </summary>
|
||||
@@ -124,6 +129,6 @@ namespace Umbraco.Web.Editors
|
||||
"text/html");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
{
|
||||
var client = new System.Net.WebClient();
|
||||
var values = new NameValueCollection { { "name", admin.Name }, { "email", admin.Email} };
|
||||
client.UploadValues("https://umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values);
|
||||
client.UploadValues("https://shop.umbraco.com/base/Ecom/SubmitEmail/installer.aspx", values);
|
||||
}
|
||||
catch { /* fail in silence */ }
|
||||
}
|
||||
@@ -147,4 +147,4 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Web.Http;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using System.Web.SessionState;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Mvc
|
||||
{
|
||||
@@ -93,6 +95,13 @@ namespace Umbraco.Web.Mvc
|
||||
}
|
||||
//look in this namespace to create the controller
|
||||
controllerPluginRoute.DataTokens.Add("Namespaces", new[] {controllerType.Namespace});
|
||||
|
||||
//Special case! Check if the controller type implements IRequiresSessionState and if so use our
|
||||
//custom webapi session handler
|
||||
if (typeof(IRequiresSessionState).IsAssignableFrom(controllerType))
|
||||
{
|
||||
controllerPluginRoute.RouteHandler = new SessionHttpControllerRouteHandler();
|
||||
}
|
||||
}
|
||||
|
||||
//Don't look anywhere else except this namespace!
|
||||
@@ -100,9 +109,9 @@ namespace Umbraco.Web.Mvc
|
||||
|
||||
//constraints: only match controllers ending with 'controllerSuffixName' and only match this controller's ID for this route
|
||||
if (controllerSuffixName.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
controllerPluginRoute.Constraints = new RouteValueDictionary(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
controllerPluginRoute.Constraints = new RouteValueDictionary(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{"controller", @"(\w+)" + controllerSuffixName}
|
||||
});
|
||||
|
||||
@@ -112,9 +112,8 @@
|
||||
<Reference Include="dotless.Core, Version=1.4.1.0, Culture=neutral, PublicKeyToken=96b446c9e63eae34, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\dotless.1.4.1.0\lib\dotless.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Examine, Version=0.1.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.80\lib\net45\Examine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
|
||||
@@ -957,6 +956,7 @@
|
||||
<Compile Include="WebApi\NamespaceHttpControllerSelector.cs" />
|
||||
<Compile Include="WebApi\PrefixlessBodyModelValidator.cs" />
|
||||
<Compile Include="WebApi\PrefixlessBodyModelValidatorAttribute.cs" />
|
||||
<Compile Include="WebApi\SessionHttpControllerRouteHandler.cs" />
|
||||
<Compile Include="WebApi\UmbracoApiController.cs" />
|
||||
<Compile Include="WebApi\UmbracoApiControllerBase.cs" />
|
||||
<Compile Include="WebApi\UmbracoApiControllerResolver.cs" />
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Web;
|
||||
using System.Web.Http.WebHost;
|
||||
using System.Web.Routing;
|
||||
using System.Web.SessionState;
|
||||
|
||||
namespace Umbraco.Web.WebApi
|
||||
{
|
||||
/// <summary>
|
||||
/// A custom WebApi route handler that enables session on the HttpContext - use with caution!
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// WebApi controllers (and REST in general) shouldn't have session state enabled since it's stateless,
|
||||
/// enabling session state puts additional locks on requests so only use this when absolutley needed
|
||||
/// </remarks>
|
||||
internal class SessionHttpControllerRouteHandler : HttpControllerRouteHandler
|
||||
{
|
||||
protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
|
||||
{
|
||||
return new SessionHttpControllerHandler(requestContext.RouteData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A custom WebApi handler that enables session on the HttpContext
|
||||
/// </summary>
|
||||
private class SessionHttpControllerHandler : HttpControllerHandler, IRequiresSessionState
|
||||
{
|
||||
public SessionHttpControllerHandler(RouteData routeData) : base(routeData)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<package id="AutoMapper" version="3.3.1" targetFramework="net45" />
|
||||
<package id="ClientDependency" version="1.9.2" targetFramework="net45" />
|
||||
<package id="dotless" version="1.4.1.0" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.80" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.81" targetFramework="net45" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="Markdown" version="1.14.7" targetFramework="net45" />
|
||||
|
||||
@@ -394,6 +394,11 @@ namespace umbraco
|
||||
}
|
||||
|
||||
public virtual void ClearDocumentCache(int documentId)
|
||||
{
|
||||
ClearDocumentCache(documentId, true);
|
||||
}
|
||||
|
||||
internal virtual void ClearDocumentCache(int documentId, bool removeDbXmlEntry)
|
||||
{
|
||||
// Get the document
|
||||
Document d;
|
||||
@@ -408,7 +413,7 @@ namespace umbraco
|
||||
ClearDocumentXmlCache(documentId);
|
||||
return;
|
||||
}
|
||||
ClearDocumentCache(d);
|
||||
ClearDocumentCache(d, removeDbXmlEntry);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -416,7 +421,8 @@ namespace umbraco
|
||||
/// This means the node gets unpublished from the website.
|
||||
/// </summary>
|
||||
/// <param name="doc">The document</param>
|
||||
internal void ClearDocumentCache(Document doc)
|
||||
/// <param name="removeDbXmlEntry"></param>
|
||||
internal void ClearDocumentCache(Document doc, bool removeDbXmlEntry)
|
||||
{
|
||||
var e = new DocumentCacheEventArgs();
|
||||
FireBeforeClearDocumentCache(doc, e);
|
||||
@@ -425,8 +431,13 @@ namespace umbraco
|
||||
{
|
||||
XmlNode x;
|
||||
|
||||
// remove from xml db cache
|
||||
doc.XmlRemoveFromDB();
|
||||
//Hack: this is here purely for backwards compat if someone for some reason is using the
|
||||
// ClearDocumentCache(int documentId) method and expecting it to remove the xml
|
||||
if (removeDbXmlEntry)
|
||||
{
|
||||
// remove from xml db cache
|
||||
doc.XmlRemoveFromDB();
|
||||
}
|
||||
|
||||
// clear xml cache
|
||||
ClearDocumentXmlCache(doc.Id);
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace UmbracoExamine.Config
|
||||
public static class IndexSetExtensions
|
||||
{
|
||||
internal static IIndexCriteria ToIndexCriteria(this IndexSet set, IDataService svc,
|
||||
IEnumerable<StaticField> indexFieldPolicies)
|
||||
StaticFieldCollection indexFieldPolicies)
|
||||
{
|
||||
return new LazyIndexCriteria(set, svc, indexFieldPolicies);
|
||||
}
|
||||
@@ -29,7 +29,7 @@ namespace UmbracoExamine.Config
|
||||
/// <returns></returns>
|
||||
public static IIndexCriteria ToIndexCriteria(this IndexSet set, IDataService svc)
|
||||
{
|
||||
return set.ToIndexCriteria(svc, Enumerable.Empty<StaticField>());
|
||||
return set.ToIndexCriteria(svc, new StaticFieldCollection());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace UmbracoExamine.Config
|
||||
public LazyIndexCriteria(
|
||||
IndexSet set,
|
||||
IDataService svc,
|
||||
IEnumerable<StaticField> indexFieldPolicies)
|
||||
StaticFieldCollection indexFieldPolicies)
|
||||
{
|
||||
if (set == null) throw new ArgumentNullException("set");
|
||||
if (indexFieldPolicies == null) throw new ArgumentNullException("indexFieldPolicies");
|
||||
@@ -35,8 +35,9 @@ namespace UmbracoExamine.Config
|
||||
foreach (var u in userProps)
|
||||
{
|
||||
var field = new IndexField() { Name = u };
|
||||
var policy = indexFieldPolicies.FirstOrDefault(x => x.Name == u);
|
||||
if (policy != null)
|
||||
|
||||
StaticField policy;
|
||||
if (indexFieldPolicies.TryGetValue(u, out policy))
|
||||
{
|
||||
field.Type = policy.Type;
|
||||
field.EnableSorting = policy.EnableSorting;
|
||||
@@ -55,8 +56,9 @@ namespace UmbracoExamine.Config
|
||||
foreach (var s in sysProps)
|
||||
{
|
||||
var field = new IndexField() { Name = s };
|
||||
var policy = indexFieldPolicies.FirstOrDefault(x => x.Name == s);
|
||||
if (policy != null)
|
||||
|
||||
StaticField policy;
|
||||
if (indexFieldPolicies.TryGetValue(s, out policy))
|
||||
{
|
||||
field.Type = policy.Type;
|
||||
field.EnableSorting = policy.EnableSorting;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace UmbracoExamine
|
||||
{
|
||||
internal class StaticFieldCollection : KeyedCollection<string, StaticField>
|
||||
{
|
||||
protected override string GetKeyForItem(StaticField item)
|
||||
{
|
||||
return item.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements TryGetValue using the underlying dictionary
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="field"></param>
|
||||
/// <returns></returns>
|
||||
public bool TryGetValue(string key, out StaticField field)
|
||||
{
|
||||
if (Dictionary == null)
|
||||
{
|
||||
field = null;
|
||||
return false;
|
||||
}
|
||||
return Dictionary.TryGetValue(key, out field);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,27 +196,27 @@ namespace UmbracoExamine
|
||||
/// Alot of standard umbraco fields shouldn't be tokenized or even indexed, just stored into lucene
|
||||
/// for retreival after searching.
|
||||
/// </summary>
|
||||
internal static readonly List<StaticField> IndexFieldPolicies
|
||||
= new List<StaticField>
|
||||
internal static readonly StaticFieldCollection IndexFieldPolicies
|
||||
= new StaticFieldCollection
|
||||
{
|
||||
new StaticField("id", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("key", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"),
|
||||
new StaticField( "writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"),
|
||||
new StaticField( "createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
|
||||
new StaticField( "updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
|
||||
new StaticField( "nodeName", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField( "urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField( "writerName", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField( "creatorName", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField( "nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField( "path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty)
|
||||
new StaticField("version", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("parentID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("level", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"),
|
||||
new StaticField("writerID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("creatorID", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("nodeType", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("template", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("sortOrder", FieldIndexTypes.NOT_ANALYZED, true, "NUMBER"),
|
||||
new StaticField("createDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
|
||||
new StaticField("updateDate", FieldIndexTypes.NOT_ANALYZED, false, "DATETIME"),
|
||||
new StaticField("nodeName", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField("urlName", FieldIndexTypes.NOT_ANALYZED, false, string.Empty),
|
||||
new StaticField("writerName", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField("creatorName", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField("nodeTypeAlias", FieldIndexTypes.ANALYZED, false, string.Empty),
|
||||
new StaticField("path", FieldIndexTypes.NOT_ANALYZED, false, string.Empty)
|
||||
};
|
||||
|
||||
#endregion
|
||||
@@ -709,15 +709,16 @@ namespace UmbracoExamine
|
||||
// Get all user data that we want to index and store into a dictionary
|
||||
foreach (var field in IndexerData.UserFields)
|
||||
{
|
||||
if (e.Fields.ContainsKey(field.Name))
|
||||
string fieldVal;
|
||||
if (e.Fields.TryGetValue(field.Name, out fieldVal))
|
||||
{
|
||||
//check if the field value has html
|
||||
if (XmlHelper.CouldItBeXml(e.Fields[field.Name]))
|
||||
if (XmlHelper.CouldItBeXml(fieldVal))
|
||||
{
|
||||
//First save the raw value to a raw field, we will change the policy of this field by detecting the prefix later
|
||||
e.Fields[RawFieldPrefix + field.Name] = e.Fields[field.Name];
|
||||
e.Fields[RawFieldPrefix + field.Name] = fieldVal;
|
||||
//now replace the original value with the stripped html
|
||||
e.Fields[field.Name] = DataService.ContentService.StripHtml(e.Fields[field.Name]);
|
||||
e.Fields[field.Name] = DataService.ContentService.StripHtml(fieldVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -803,9 +804,13 @@ namespace UmbracoExamine
|
||||
/// <param name="fieldName"></param>
|
||||
/// <returns></returns>
|
||||
protected override FieldIndexTypes GetPolicy(string fieldName)
|
||||
{
|
||||
var def = IndexFieldPolicies.Where(x => x.Name == fieldName).ToArray();
|
||||
return (def.Any() == false ? FieldIndexTypes.ANALYZED : def.Single().IndexType);
|
||||
{
|
||||
StaticField def;
|
||||
if (IndexFieldPolicies.TryGetValue(fieldName, out def))
|
||||
{
|
||||
return def.IndexType;
|
||||
}
|
||||
return FieldIndexTypes.ANALYZED;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -815,14 +820,18 @@ namespace UmbracoExamine
|
||||
/// </summary>
|
||||
protected override bool ValidateDocument(XElement node)
|
||||
{
|
||||
var nodeId = int.Parse(node.Attribute("id").Value);
|
||||
// Test for access if we're only indexing published content
|
||||
// return nothing if we're not supporting protected content and it is protected, and we're not supporting unpublished content
|
||||
if (!SupportUnpublishedContent
|
||||
&& (!SupportProtectedContent
|
||||
&& DataService.ContentService.IsProtected(nodeId, node.Attribute("path").Value)))
|
||||
if (SupportUnpublishedContent == false
|
||||
&& SupportProtectedContent == false)
|
||||
{
|
||||
return false;
|
||||
|
||||
var nodeId = int.Parse(node.Attribute("id").Value);
|
||||
|
||||
if (DataService.ContentService.IsProtected(nodeId, node.Attribute("path").Value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return base.ValidateDocument(node);
|
||||
}
|
||||
|
||||
@@ -82,9 +82,8 @@
|
||||
<AssemblyOriginatorKeyFile>..\Solution Items\TheFARM-Public.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Examine, Version=0.1.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.80\lib\net45\Examine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
@@ -134,6 +133,7 @@
|
||||
<Compile Include="LocalStorage\MultiIndexOutput.cs" />
|
||||
<Compile Include="LoggingLevel.cs" />
|
||||
<Compile Include="StaticField.cs" />
|
||||
<Compile Include="StaticFieldCollection.cs" />
|
||||
<Compile Include="UmbracoMemberIndexer.cs" />
|
||||
<Compile Include="ContentExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@@ -117,8 +117,9 @@ namespace UmbracoExamine
|
||||
if (indexerData.UserFields.Any(x => x.Name == "_searchEmail") == false)
|
||||
{
|
||||
var field = new IndexField { Name = "_searchEmail" };
|
||||
var policy = IndexFieldPolicies.FirstOrDefault(x => x.Name == "_searchEmail");
|
||||
if (policy != null)
|
||||
|
||||
StaticField policy;
|
||||
if (IndexFieldPolicies.TryGetValue("_searchEmail", out policy))
|
||||
{
|
||||
field.Type = policy.Type;
|
||||
field.EnableSorting = policy.EnableSorting;
|
||||
@@ -237,10 +238,16 @@ namespace UmbracoExamine
|
||||
{
|
||||
var fields = base.GetSpecialFieldsToIndex(allValuesForIndexing);
|
||||
|
||||
//adds the special path property to the index
|
||||
//adds the special key property to the index
|
||||
string valuesForIndexing;
|
||||
if (allValuesForIndexing.TryGetValue("__key", out valuesForIndexing))
|
||||
fields.Add("__key", valuesForIndexing);
|
||||
{
|
||||
if (fields.ContainsKey("__key") == false)
|
||||
{
|
||||
fields.Add("__key", valuesForIndexing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return fields;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Examine" version="0.1.80" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.81" targetFramework="net45" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
|
||||
</packages>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Examine" version="0.1.80" targetFramework="net45" />
|
||||
<package id="Examine" version="0.1.81" targetFramework="net45" />
|
||||
<package id="HtmlAgilityPack" version="1.4.9" targetFramework="net45" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.3" targetFramework="net45" />
|
||||
|
||||
@@ -45,9 +45,8 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Examine, Version=0.1.80.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.80\lib\net45\Examine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Reference Include="Examine, Version=0.1.81.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Examine.0.1.81\lib\net45\Examine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="HtmlAgilityPack, Version=1.4.9.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\HtmlAgilityPack.1.4.9\lib\Net45\HtmlAgilityPack.dll</HintPath>
|
||||
|
||||
Reference in New Issue
Block a user