Skip to content

Instantly share code, notes, and snippets.

View martinrayenglish's full-sized avatar

Martin English martinrayenglish

View GitHub Profile
$sql = @"
WITH publishoptions
AS (SELECT [id],
[Options].value('declare namespace ns=""; (/ns:PublishOptionsEntity/ns:ItemId)[1]',
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 {
<?xml version="1.0"?>
<configuration xmlns:patch="" xmlns:role="">
<httpRequestProcessed role:require="ContentManagement or Standalone">
<processor type="MyProject.Foundation.SitecoreExtensions.Pipelines.HttpRequestProcessed.RemoveNonEditingHtmlElements, MyProject.Foundation.SitecoreExtensions" resolve="true" />
internal class RemoveHtmlElementResponseFilter : Stream
private readonly MemoryStream _internalStream = new MemoryStream();
private bool _disposed;
public RemoveHtmlElementResponseFilter([NotNull] Stream stream)
ResponseStream = stream;
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" };
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)
public override void Flush()
var numArray = _internalStream.ToArray();
if (numArray.Length == 0)
if (HttpContext.Current?.Server.GetLastError() != null)
/// <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,
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:patch="" xmlns:set="" xmlns:role="" >
<pipelines role:require="ContentDelivery">
<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>