Skip to content

Instantly share code, notes, and snippets.

View sebastiantecsi's full-sized avatar

Sebastian Tecsi sebastiantecsi

View GitHub Profile
@sebastiantecsi
sebastiantecsi / Delete.ps1
Created January 29, 2023 13:35 — forked from michaellwest/CompareFieldChanges.ps1
The following Sitecore PowerShell Extensions script finds items stored in the IAR files that also exist in the database.
$databaseName = $actionData["databaseName"]
$filename = $actionData["filename"]
$resourceLoaderType = ([System.Type]::GetType("Sitecore.Data.DataProviders.ReadOnly.Protobuf.IResourceLoader, Sitecore.Data.ResourceItems.ProtobufNet"))
$resourceLoader = [Sitecore.DependencyInjection.ServiceLocator]::ServiceProvider.GetService($resourceLoaderType)
$paths = [System.Collections.Generic.List[String]]@()
$paths.Add([Sitecore.MainUtil]::MapPath("/App_Data/items/$($databaseName)/$($filename)")) > $null
$paths.Add([Sitecore.MainUtil]::MapPath("/sitecore modules/items/$($databaseName)/$($filename)")) > $null
$defaultFieldValues = New-Object -TypeName 'System.Collections.Generic.Dictionary[[guid], [string]]'
$database = [Sitecore.Configuration.Factory]::GetDatabase($databaseName)
@sebastiantecsi
sebastiantecsi / UnicornDependencyGraphGenerator.ps1
Created January 29, 2023 13:39 — forked from alan-null/UnicornDependencyGraphGenerator.ps1
Generate unicorn dependency graph using PowerShell. Analyse and improve your configurations or easily fix existing issues
function Get-ComputedDependencyGraphUrl {
[CmdletBinding()]
param(
[Parameter(Mandatory=$true, Position=0 )]
[Hashtable]$allDependenciesClean
)
begin {
Write-Verbose "Cmdlet Get-ComputedDependencyGraphUrl - Begin"
}
# Root path to look 'orphan' items under - update here as needed
cd 'master:/sitecore/media library'
$counter = 0
$itemsToProcess = Get-ChildItem -Recurse . | Where-Object { $_.TemplateName -ne 'Media Folder' }
if ($itemsToProcess -ne $null) {
$itemsToProcess | ForEach-Object {
$referrers = Get-ItemReferrer -Item $_ | measure
if ($referrers.Count -eq 0) {
$counter++