Merge branch 'dev-v7.6' into temp-U4-9314

This commit is contained in:
Warren Buckley
2017-02-07 17:27:07 +00:00
committed by GitHub
29 changed files with 292 additions and 220 deletions

View File

@@ -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="[2.0.4, 3.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 -->
@@ -104,4 +104,4 @@
<file src="..\_BuildOutput\bin\UmbracoExamine.pdb" target="lib" />
<file src="..\..\src\UmbracoExamine\**\*.cs" exclude="..\..\src\**\TemporaryGeneratedFile*.cs" target="src\UmbracoExamine" />
</files>
</package>
</package>

View File

@@ -110,7 +110,14 @@ namespace Umbraco.Core
/// </remarks>
public virtual UmbracoDatabase Database
{
get { return _factory.CreateDatabase(); }
get
{
if (IsDatabaseConfigured == false)
{
throw new InvalidOperationException("Cannot create a database instance, there is no available connection string");
}
return _factory.CreateDatabase();
}
}
/// <summary>
@@ -202,7 +209,7 @@ namespace Umbraco.Core
}
else
{
throw new InvalidOperationException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'");
throw new NullReferenceException("Can't find a connection string with the name '" + Constants.System.UmbracoConnectionName + "'");
}
return _providerName;
}

View File

@@ -167,12 +167,12 @@ namespace Umbraco.Core.Persistence
var providerName = Constants.DatabaseProviders.SqlServer;
if (ConfigurationManager.ConnectionStrings[connectionStringName] != null)
{
if (!string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName))
if (string.IsNullOrEmpty(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName) == false)
providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName;
}
else
{
throw new InvalidOperationException("Can't find a connection string with the name '" + connectionStringName + "'");
throw new NullReferenceException("Can't find a connection string with the name '" + connectionStringName + "'");
}
// Store factory and connection string

View File

@@ -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>

View File

@@ -63,9 +63,12 @@ namespace Umbraco.Core
// after Umbraco has started there is a database in "context" and that context is
// going to stay there and never get destroyed nor reused, so we have to ensure that
// the database is disposed (which will auto-remove it from context).
var database = ApplicationContext.Current.DatabaseContext.Database;
if (database != null) // never to happen... unless in weird tests
ApplicationContext.Current.DatabaseContext.Database.Dispose();
if (ApplicationContext.Current.DatabaseContext.IsDatabaseConfigured)
{
var database = ApplicationContext.Current.DatabaseContext.Database;
if (database != null) // never to happen... unless in weird tests
ApplicationContext.Current.DatabaseContext.Database.Dispose();
}
}
/// <summary>

View File

@@ -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" />

View File

@@ -58,9 +58,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>

View File

@@ -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" />

View File

@@ -36,119 +36,119 @@ Use this directive make an element sticky and follow the page when scrolling.
@param {string} scrollableContainer Set the class (".element") or the id ("#element") of the scrollable container element.
**/
(function() {
'use strict';
(function () {
'use strict';
function StickyBarDirective($rootScope) {
function StickyBarDirective($rootScope) {
function link(scope, el, attr, ctrl) {
function link(scope, el, attr, ctrl) {
var bar = $(el);
var scrollableContainer = null;
var clonedBar = null;
var cloneIsMade = false;
var barTop = bar.context.offsetTop;
var bar = $(el);
var scrollableContainer = null;
var clonedBar = null;
var cloneIsMade = false;
function activate() {
function activate() {
if (attr.scrollableContainer) {
scrollableContainer = $(attr.scrollableContainer);
} else {
scrollableContainer = $(window);
}
if (attr.scrollableContainer) {
scrollableContainer = $(attr.scrollableContainer);
} else {
scrollableContainer = $(window);
}
scrollableContainer.on('scroll.umbStickyBar', determineVisibility).trigger("scroll");
$(window).on('resize.umbStickyBar', determineVisibility);
scrollableContainer.on('scroll.umbStickyBar', determineVisibility).trigger("scroll");
$(window).on('resize.umbStickyBar', determineVisibility);
scope.$on('$destroy', function() {
scrollableContainer.off('.umbStickyBar');
$(window).off('.umbStickyBar');
});
}
function determineVisibility() {
var scrollTop = scrollableContainer.scrollTop();
if (scrollTop > barTop) {
if (!cloneIsMade) {
createClone();
clonedBar.css({
'visibility': 'visible'
});
} else {
calculateSize();
}
} else {
if (cloneIsMade) {
//remove cloned element (switched places with original on creation)
bar.remove();
bar = clonedBar;
clonedBar = null;
bar.removeClass('-umb-sticky-bar');
bar.css({
position: 'relative',
'width': 'auto',
'height': 'auto',
'z-index': 'auto',
'visibility': 'visible'
});
cloneIsMade = false;
}
scope.$on('$destroy', function () {
scrollableContainer.off('.umbStickyBar');
$(window).off('.umbStickyBar');
});
}
}
function determineVisibility() {
function calculateSize() {
clonedBar.css({
width: bar.outerWidth(),
height: bar.height()
});
}
var barTop = bar[0].offsetTop;
var scrollTop = scrollableContainer.scrollTop();
function createClone() {
//switch place with cloned element, to keep binding intact
clonedBar = bar;
bar = clonedBar.clone();
clonedBar.after(bar);
clonedBar.addClass('-umb-sticky-bar');
clonedBar.css({
'position': 'fixed',
'z-index': 500,
'visibility': 'hidden'
});
if (scrollTop > barTop) {
cloneIsMade = true;
calculateSize();
if (!cloneIsMade) {
}
createClone();
activate();
clonedBar.css({
'visibility': 'visible'
});
}
} else {
var directive = {
restrict: 'A',
link: link
};
calculateSize();
return directive;
}
}
angular.module('umbraco.directives').directive('umbStickyBar', StickyBarDirective);
} else {
if (cloneIsMade) {
//remove cloned element (switched places with original on creation)
bar.remove();
bar = clonedBar;
clonedBar = null;
bar.removeClass('-umb-sticky-bar');
bar.css({
position: 'relative',
'width': 'auto',
'height': 'auto',
'z-index': 'auto',
'visibility': 'visible'
});
cloneIsMade = false;
}
}
}
function calculateSize() {
clonedBar.css({
width: bar.outerWidth(),
height: bar.height()
});
}
function createClone() {
//switch place with cloned element, to keep binding intact
clonedBar = bar;
bar = clonedBar.clone();
clonedBar.after(bar);
clonedBar.addClass('-umb-sticky-bar');
clonedBar.css({
'position': 'fixed',
'z-index': 500,
'visibility': 'hidden'
});
cloneIsMade = true;
calculateSize();
}
activate();
}
var directive = {
restrict: 'A',
link: link
};
return directive;
}
angular.module('umbraco.directives').directive('umbStickyBar', StickyBarDirective);
})();

View File

@@ -3,7 +3,11 @@ angular.module('umbraco')
.controller("Umbraco.PropertyEditors.MacroContainerController",
function($scope, dialogService, entityResource, macroService){
$scope.renderModel = [];
$scope.allowOpenButton = true;
$scope.allowRemoveButton = true;
$scope.sortableOptions = {};
if($scope.model.value){
var macros = $scope.model.value.split('>');
@@ -20,6 +24,7 @@ angular.module('umbraco')
parsed.syntax = syntax;
collectDetails(parsed);
$scope.renderModel.push(parsed);
setSortingState($scope.renderModel);
}
});
}
@@ -27,11 +32,12 @@ angular.module('umbraco')
function collectDetails(macro){
macro.details = "";
macro.icon = "icon-settings-alt";
if(macro.macroParamsDictionary){
angular.forEach((macro.macroParamsDictionary), function(value, key){
macro.details += key + ": " + value + " ";
});
}
}
}
function openDialog(index){
@@ -61,6 +67,8 @@ angular.module('umbraco')
$scope.renderModel.push(macroObject);
}
setSortingState($scope.renderModel);
$scope.macroPickerOverlay.show = false;
$scope.macroPickerOverlay = null;
};
@@ -90,6 +98,7 @@ angular.module('umbraco')
$scope.remove =function(index){
$scope.renderModel.splice(index, 1);
setSortingState($scope.renderModel);
};
$scope.clear = function() {
@@ -117,4 +126,13 @@ angular.module('umbraco')
return str.replace(rgxtrim, '');
}
function setSortingState(items) {
// disable sorting if the list only consist of one item
if(items.length > 1) {
$scope.sortableOptions.disabled = false;
} else {
$scope.sortableOptions.disabled = true;
}
}
});

View File

@@ -1,30 +1,27 @@
<div ng-controller="Umbraco.PropertyEditors.MacroContainerController" class="umb-editor umb-macrocontainer">
<ul class="unstyled list-icons"
ui-sortable="sortableOptions"
ng-model="renderModel">
<li ng-repeat="macro in renderModel" style="max-width: 300px">
<div ui-sortable="sortableOptions" ng-model="renderModel">
<div ng-repeat="macro in renderModel">
<umb-node-preview
name="macro.macroAlias"
icon="macro.icon"
description="macro.details"
sortable="!sortableOptions.disabled"
allow-remove="allowRemoveButton"
allow-open="allowOpenButton && macro.details"
on-remove="remove($index)"
on-open="edit($index)">
</umb-node-preview>
</div>
</div>
<i class="icon icon-navigation handle"></i>
<div class="pull-right">
<a href ng-click="edit($index)"><i ng-show="macro.details" class="icon icon-edit"></i></a>
<i class="icon icon-delete red" ng-click="remove($index)" ></i>
</div>
<a href="#" prevent-default ng-click="edit($index)">{{macro.macroAlias}}</a>
<small class="umb-detail">{{macro.details}}</small>
</li>
</ul>
<ul class="unstyled list-icons" ng-hide="model.config.max && model.config.max > 0 && renderModel.length >= model.config.max">
<li>
<i class="icon icon-add blue"></i>
<a href="#" ng-click="add()" prevent-default>
<localize key="general_add">Add</localize>
</a>
</li>
</ul>
<a ng-hide="model.config.max && model.config.max > 0 && renderModel.length >= model.config.max"
class="umb-node-preview-add"
href=""
ng-click="add()"
prevent-default>
<localize key="general_add">Add</localize>
</a>
<umb-overlay
ng-if="macroPickerOverlay.show"

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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();

View File

@@ -99,23 +99,15 @@ namespace Umbraco.Web.Editors
var files = contentItem.UploadedFiles.Where(x => x.PropertyAlias == property.Alias).ToArray();
if (files.Length > 0)
{
dictionary.Add("files", files);
// add extra things needed to figure out where to put the files
dictionary.Add("cuid", contentItem.PersistedContent.Key);
dictionary.Add("puid", dboProperty.PropertyType.Key);
dictionary.Add("files", files);
}
foreach (var file in files)
file.FileName = file.FileName.ToSafeFileName();
if (files.Length > 0)
{
dictionary.Add("files", files);
// add extra things needed to figure out where to put the files
dictionary.Add("cuid", contentItem.PersistedContent.Key);
dictionary.Add("puid", dboProperty.PropertyType.Key);
}
// add extra things needed to figure out where to put the files
dictionary.Add("cuid", contentItem.PersistedContent.Key);
dictionary.Add("puid", dboProperty.PropertyType.Key);
var data = new ContentPropertyData(property.Value, property.PreValues, dictionary);
//get the deserialized value from the property editor

View File

@@ -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
}
}
}
}
}

View File

@@ -9,7 +9,7 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.MacroContainerAlias, "Macro container", "macrocontainer", ValueType = PropertyEditorValueTypes.Text, Group="rich content", Icon="icon-settings-alt")]
[PropertyEditor(Constants.PropertyEditors.MacroContainerAlias, "Macro Picker", "macrocontainer", ValueType = PropertyEditorValueTypes.Text, Group="rich content", Icon="icon-settings-alt")]
public class MacroContainerPropertyEditor : PropertyEditor
{
/// <summary>

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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);

View File

@@ -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());
}
}

View File

@@ -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;

View File

@@ -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);
}
}
}

View File

@@ -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
@@ -804,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>
@@ -816,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);
}

View File

@@ -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" />

View File

@@ -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;

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>