Skip to content

Instantly share code, notes, and snippets.

Avatar

Martin English martinrayenglish

View GitHub Profile
View IndexItemCheckv1.ps1
<#
.SYNOPSIS
NOTE: Check for items in the selected target database that are missing from selected index, and output downloadable report
#>
$missingFromIndexList = [System.Collections.ArrayList]@()
$startDatabase = "master"
$root = Get-Item -Path "$($startDatabase):\content"
filter IndexCheck {
View sc.publishing.relateditems.xml
<PublishRelatedItemDescendants>
<DatasourceTemplate1>AB86861A-6030-46C5-B394-E8F99E8B87DB</DatasourceTemplate1>
<DatasourceTemplate2>529BBBB4-8C92-423A-85E4-755CAD4DBC51</DatasourceTemplate2>
...
</PublishRelatedItemDescendants>
View MyProject.Foundation.SitecoreExtensions.config
<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
<sitecore>
<pipelines>
<httpRequestProcessed role:require="ContentManagement or Standalone">
<processor type="MyProject.Foundation.SitecoreExtensions.Pipelines.HttpRequestProcessed.RemoveNonEditingHtmlElements, MyProject.Foundation.SitecoreExtensions" resolve="true" />
</httpRequestProcessed>
</pipelines>
</sitecore>
</configuration>
View RemoveHtmlElementResponseFilter.cs
internal class RemoveHtmlElementResponseFilter : Stream
{
[NotNull]
private readonly MemoryStream _internalStream = new MemoryStream();
private bool _disposed;
public RemoveHtmlElementResponseFilter([NotNull] Stream stream)
{
ResponseStream = stream;
View Constants.cs
public struct Constants
{
public struct NonEditingHtml
{
public const string DataExpOffAttribute = "data-xp-off";
public const string ExceptionMessage = "Non editing attributes removal process did not run because an error occurred during the request execution";
public static readonly string[] TargetElements = { "script", "style", "noscript" };
}
}
View RemoveNonEditingHtmlElements.cs
public class RemoveNonEditingHtmlElements : HttpRequestProcessor
{
public override void Process(HttpRequestArgs args)
{
if (args.HttpContext.Response.HeadersWritten ||
Context.Site == null ||
Context.Site.Name == "shell" ||
Context.Item == null)
{
return;
View RemoveHtmlElementResponseFilter-Agility.cs
public override void Flush()
{
var numArray = _internalStream.ToArray();
if (numArray.Length == 0)
{
return;
}
if (HttpContext.Current?.Server.GetLastError() != null)
View Sitecore.Security.AccessControl.cs
/// <summary>
/// Gets the access control type for an item from its ancestors.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="account">The account.</param>
/// <param name="accessRight">The desired access right.</param>
/// <param name="propagationType">Type of propagation.</param>
/// <returns></returns>
protected virtual AccessResult GetAncestorAccess(
Item item,
View My.Project.Common.Performance.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/" >
<sitecore>
<pipelines role:require="ContentDelivery">
<initialize>
<processor type="Sitecore.Analytics.Pipelines.Loader.StartThreadPoolSizeMonitor, Sitecore.Analytics">
<param desc="accelerationRate">200</param>
<param desc="decelerationRate">10</param>
<param desc="updateInterval">00:00:00.250</param>
</processor>
@martinrayenglish
martinrayenglish / ThreadPoolSizeMonitor.cs
Created Sep 20, 2020
Sitecore Thread Pool Size Monitor
View ThreadPoolSizeMonitor.cs
using Sitecore.Abstractions;
using Sitecore.Framework.Conditions;
using System;
using System.Threading;
namespace Sitecore.Analytics
{
internal class ThreadPoolSizeMonitor : IThreadPoolSizeMonitor, IDisposable
{
private readonly int _accelerationRate;