mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Update ImageProfileManager.cs
Image cache is empty after every reboot of the Orchard app. It makey Dynamic ImageProfiles reprocess images after every reboot. It has a big impact on performance because all the images that use dynamic profiles are reprocessed when they are requested after a reboot. When you open a page with a number of images disks usage increases drammatically and the apps answer very slow to other requests This is related with this issue https://github.com/OrchardCMS/Orchard/issues/5061
This commit is contained in:
@@ -64,6 +64,18 @@ namespace Orchard.MediaProcessing.Services {
|
||||
var filePath = _fileNameProvider.GetFileName(profileName, System.Web.HttpUtility.UrlDecode(path));
|
||||
bool process = false;
|
||||
|
||||
//after reboot the app cache is empty so we reload the image in the cache if it exists in the _Profiles folder
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
var filterContext = new FilterContext { FilePath = _storageProvider.Combine("_Profiles", FormatProfilePath(profileName, System.Web.HttpUtility.UrlDecode(path))) };
|
||||
|
||||
if (_storageProvider.FileExists(filterContext.FilePath))
|
||||
{
|
||||
_fileNameProvider.UpdateFileName(profileName, System.Web.HttpUtility.UrlDecode(path), filterContext.FilePath);
|
||||
filePath = _fileNameProvider.GetFileName(profileName, path);
|
||||
}
|
||||
}
|
||||
|
||||
// if the filename is not cached, process it
|
||||
if (string.IsNullOrEmpty(filePath)) {
|
||||
Logger.Debug("FilePath is null, processing required, profile {0} for image {1}", profileName, path);
|
||||
|
Reference in New Issue
Block a user