Skip to content

Instantly share code, notes, and snippets.

@pedroadaodev
pedroadaodev / RedirectToLanguage.cshtml
Last active August 9, 2016 11:15 — forked from ndias86/RedirectToLanguage.cshtml
Umbraco : on root node, redirect to current users browser culture ex: /en/ or /fr/
@using System.Globalization
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
string[] languages = HttpContext.Current.Request.UserLanguages;
var detectedLanguage = false;
var urlToRedirect = "/en/"; // TODO : go to first node homepage?
HttpCookie cookieOptIn = Request.Cookies.Get("curLang");
@pedroadaodev
pedroadaodev / umbraco db cleanup.sql
Last active August 11, 2021 09:52 — forked from dampee/umbraco db cleanup.sql
Umbraco Database cleanup. After pulling in an umbraco database from production, you don't need all history or log.
-- Umbraco Clear Old Document Versions To Decrease Database Size And Improve Performance
-- http://borism.net/2008/12/16/fixing-a-large-cmspropertydata-table-in-umbraco/
--DECLARE @createdDate Datetime = DATEADD(m, -1, getdate()) -- If you want to get 2 weeks without maintenance - 40 minutes to run
DECLARE @createdDate Datetime = DATEADD(day, -10, getdate()) -- If you want to get 3/4 weeks without maintenance - 60 minutes to run
--select @createdDate
-- dump logs
-- TRUNCATE TABLE umbracolog -- faster if log table is very big and you don't need anything
DELETE FROM umbracolog WHERE Datestamp < @createdDate
print 'deleted umbracologs'