Skip to content

Instantly share code, notes, and snippets.

View danielrolfe's full-sized avatar

Daniel Rolfe danielrolfe

  • Productive Edge
View GitHub Profile
@danielrolfe
danielrolfe / SitecoreEmptyRecycleBin.sql
Created September 17, 2020 21:42
Simple SQL script to delete the recycle bin rows from the Sitecore Archive tables. Use it at your own risk!
declare @CleanupList table(ArchivalId uniqueidentifier)
declare @ArchivalId uniqueidentifier
insert into @CleanupList(ArchivalId)
select ArchivalId
from dbo.Archive
where ArchiveName = 'recyclebin'
while(1 = 1)
begin
set @ArchivalId = NULL
select top (1) @ArchivalId = ArchivalId
@danielrolfe
danielrolfe / CleanupRedundantMediaLibraryLanguageVersions.ps1
Created September 17, 2020 00:52
Removes language versions of Sitecore media library items
$mediasourceRootPath = "master:/sitecore/media library"
$isDryRun = $false
Write-Host "Cleaning up Media Library language versions for all items under this path: " $location
$time = Measure-Command {
New-UsingBlock (New-Object Sitecore.Data.BulkUpdateContext) {
New-UsingBlock (New-Object Sitecore.SecurityModel.SecurityDisabler) {
New-UsingBlock (New-Object Sitecore.Data.DatabaseCacheDisabler) {
New-UsingBlock (New-Object Sitecore.Data.Events.EventDisabler) {