OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

#6981: Normalized image profile path hash and added profile purging #8788

Closed BenedekFarkas closed 2 months ago

BenedekFarkas commented 2 months ago

Fixes #6981

Originally developed by @anoordende from @zumeymedia in #6984.

Original description

This resolves both issue #6981 by normalizing the profile path hash, as well as re-introduces an old CodePlex PR that missed the GitHub boat, namely the ability to purge profiles through the Admin UI.

Normalizing the image profile path

Normalizing the image profile path hash "should" be the default for all new sites, as it allows for changing the domain from which images are served, whilst maintaining the already generated profiles. This enables, for example, 301 SEO-friendly redirects when moving from local storage to azure storage or moving to a CDN by simply redirecting one-to-one at the ^_Profiles/.* level.

Important for Release Notes Existing sites may opt-out from Normalizing the profile paths, especially those which are not serving from the local Media folder, those which use a container other than "media" in Azure Blob Storage and those sites which use a custom storage provider. This can be achieved by setting the following AppSetting to false, which sets the behavior exactly as before:

<add key="Orchard.MediaProcessing.NormalizePath" value="false" />

Purging Profiles

As mentioned, this PR also enables 2 purge options form the Admin > Media > Profiles view, forcing profiles to be regenerated and old "orphaned" images will be cleared:

  1. Purge all images under an individual profile
  2. Purge all obsolete images, including all dynamic profiles (such as the Admin UI thumbs)

This functionality sits quite naturally with the normalization of the hashes, as those who wish to implement the normalization on existing sites immediately have a function to clear the old profiles (using the Purge Obsolete option). Though for SEO purposes you probably want to wait a few months before doing so.


Additional changes