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],
[jobid],
[status],
[statusmessage],
[queued],
[started],
[stopped],
[Options].value('declare namespace ns="http://schemas.datacontract.org/2004/07/Sitecore.Framework.Publishing.PublishJobQueue"; (/ns:PublishOptionsEntity/ns:ItemId)[1]',
<#
.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 {
<PublishRelatedItemDescendants>
<DatasourceTemplate1>AB86861A-6030-46C5-B394-E8F99E8B87DB</DatasourceTemplate1>
<DatasourceTemplate2>529BBBB4-8C92-423A-85E4-755CAD4DBC51</DatasourceTemplate2>
...
</PublishRelatedItemDescendants>
<?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>
internal class RemoveHtmlElementResponseFilter : Stream
{
[NotNull]
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)
{
return;
public override void Flush()
{
var numArray = _internalStream.ToArray();
if (numArray.Length == 0)
{
return;
}
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="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>