public MaxMediaFileSizeExceededException MaxFileSizeExceeded(string fileName, long fileSize, long maxSize) { return(new MaxMediaFileSizeExceededException(T( "Admin.Media.Exception.MaxFileSizeExceeded", fileName.NaIfEmpty(), Prettifier.BytesToString(fileSize), Prettifier.BytesToString(maxSize)))); }
/// <summary> /// Processes an out-of-memory exception and hard aborts the export /// </summary> /// <param name="exception">Out-of-memory exception</param> /// <param name="entityId">Identifier of the current entity</param> /// <param name="localizer">Localizer</param> public void RecordOutOfMemoryException(OutOfMemoryException exception, int entityId, Localizer localizer) { Abort = DataExchangeAbortion.Hard; var fileLength = Prettifier.BytesToString(DataStream.Length); var batchSizeString = localizer("Admin.DataExchange.Export.BatchSize").Text; Log.Fatal($"No more memory could be allocated. Probably the export file is getting too large ({fileLength}). Please use profile setting \"{batchSizeString}\" to split the export into smaller files."); RecordException(exception, entityId); }
public static string Prettify(object input, bool allowSpace) { if (CommonHelper.TryConvert <long>(input, out var l)) { return(Prettifier.BytesToString(l)); } else if (input is string s) { return(s.Slugify(allowSpace)); } return(null); }
public ActionResult Maintenance() { var model = new MaintenanceModel(); model.DeleteGuests.EndDate = DateTime.UtcNow.AddDays(-7); model.DeleteGuests.OnlyWithoutShoppingCart = true; // image cache stats long imageCacheFileCount = 0; long imageCacheTotalSize = 0; _imageCache.Value.CacheStatistics(out imageCacheFileCount, out imageCacheTotalSize); model.DeleteImageCache.FileCount = imageCacheFileCount; model.DeleteImageCache.TotalSize = Prettifier.BytesToString(imageCacheTotalSize); return(View(model)); }
public ActionResult Maintenance() { if (!_services.Permissions.Authorize(StandardPermissionProvider.ManageMaintenance)) { return(AccessDeniedView()); } var model = new MaintenanceModel(); model.DeleteGuests.EndDate = DateTime.UtcNow.AddDays(-7); model.DeleteGuests.OnlyWithoutShoppingCart = true; // image cache stats long imageCacheFileCount = 0; long imageCacheTotalSize = 0; _imageCache.Value.CacheStatistics(out imageCacheFileCount, out imageCacheTotalSize); model.DeleteImageCache.FileCount = imageCacheFileCount; model.DeleteImageCache.TotalSize = Prettifier.BytesToString(imageCacheTotalSize); return(View(model)); }