This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ghcs { | |
# Debug support provided by common PowerShell function parameters, which is natively aliased as -d or -db | |
# https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_commonparameters?view=powershell-7.4#-debug | |
param( | |
[Parameter()] | |
[string]$Hostname, | |
[ValidateSet('gh', 'git', 'shell')] | |
[Alias('t')] | |
[String]$Target = 'shell', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*|node_modules\ .git\ .svn\ .idea\ .vs\ viewstate\ node_modules\ packages\ Debug\ Obj\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tail Sitecore log files, even when using rolling log files | |
# ========================================================== | |
# 1) Copy this file into your App_Data folder or set the logFolder parameter to point to the Sitecore logs folder. | |
# 2) Run it in Powershell | |
# 3) View the log messages as they appear (even if the worker process recycles) | |
param ( | |
[string]$logFolder = ".\\logs\\", | |
[string]$filter = "log.*", | |
[int]$tailAmount = 20 | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (Tags.Contains("fail", StringComparer.InvariantCultureIgnoreCase)) | |
{ | |
ChecksRun.Checks.Add(new AlwaysFailCheck()); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add your checks here | |
ChecksRun.Checks.Add(new ItemExistsCheck("Folder template", "{A87A00B1-E6DB-45AB-8B54-636FEC3B5523}", new[] { "master", "web" }, null, false)); | |
ChecksRun.Checks.Add(new ItemExistsCheck("Launchpad has layout", "{6B846FBD-8549-4C91-AE6B-18286EFE82D2}", new[] { "core" }, new string[] { "en" }, true)); | |
ChecksRun.Checks.Add(new SearchIndexSizeCheck("Master index", "sitecore_master_index", 1000, null)); | |
ChecksRun.Checks.Add(new UrlCheck("Google is reachable", "http://www.google.com/")); | |
ChecksRun.Checks.Add(new ConfigCheck("Check if master database is available", "/sitecore/databases/database[@id='master']", 1)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Optional: uncomment whichever ways you feel are appropriate for security | |
// Ensure that your monitoring tool matches these | |
if (!(true | |
//&& Request.IsSecureConnection // Checks if using HTTPS | |
//&& Request.QueryString["authkey"] == @"secret" | |
&& Request.UserHostAddress == "127.0.0.1" | |
//&& Sitecore.Context.IsLoggedIn | |
//&& Sitecore.Context.IsAdministrator | |
//&& Sitecore.Context.User.IsInRole(@"sitecore\Developer") | |
)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test(Description = "Checks if all Glass mapper template and field IDs can be found in serialized data")] | |
public void ShouldAllTemplatesAndFieldsBeFoundInSerializedData( | |
[Values( | |
typeof(SomeType), // From assembly MyProject | |
)] | |
Type typeFromAssembyUnderTest) | |
{ | |
Assembly assemblyUnderTest = Assembly.GetAssembly(typeFromAssembyUnderTest); | |
// Find all templates and fields that need to be checked in the serialized data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[SitecoreType(TemplateId = "{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}")] | |
public interface ISampleItem | |
{ | |
[SitecoreField(FieldId = "{75577384-3C97-45DA-A847-81B00500E250}")] | |
string Title { get; set; } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Test(Description = "Checks if Sitecore IDs in a class with constants can be found in the serialized data")] | |
public void ShouldIdsBeFoundInSerializedData( | |
[Values(typeof(Constants))] | |
Type typeWithIdConstants) | |
{ | |
foreach (FieldInfo field in typeWithIdConstants | |
.GetFields(BindingFlags.Public | BindingFlags.Static) | |
.Where(f => f.FieldType == typeof (ID))) | |
{ | |
ID constantValue = field.GetValue(null) as ID; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Constants | |
{ | |
public static readonly ID SampleTemplateId | |
= new ID("{76036F5E-CBCE-46D1-AF0A-4143F9B557AA}"); | |
} |
NewerOlder