Merge remote-tracking branch 'origin/6.1.4' into 7.0.0
Conflicts: src/Umbraco.Core/Events/RecycleBinEventArgs.cs src/Umbraco.Core/Persistence/Querying/BaseExpressionHelper.cs src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs src/Umbraco.Core/Persistence/Repositories/Interfaces/IContentRepository.cs src/Umbraco.Core/Persistence/Repositories/SimilarNodeNameComparer.cs src/Umbraco.Web.UI/config/ExamineIndex.config src/Umbraco.Web/Strategies/DeleteFilesAfterEmptiedRecycleBin.cs src/Umbraco.Web/Umbraco.Web.csproj
This commit is contained in:
@@ -1029,28 +1029,29 @@ namespace Umbraco.Core.Services
|
||||
/// </summary>
|
||||
public void EmptyRecycleBin()
|
||||
{
|
||||
//TODO: Why don't we have a base class to share between MediaService/ContentService as some of this is exacty the same?
|
||||
|
||||
var uow = _uowProvider.GetUnitOfWork();
|
||||
using (var repository = _repositoryFactory.CreateContentRepository(uow))
|
||||
using (new WriteLock(Locker))
|
||||
{
|
||||
/*var query = Query<IContent>.Builder.Where(x => x.Trashed == true);
|
||||
var contents = repository.GetByQuery(query).OrderByDescending(x => x.Level);
|
||||
List<int> ids;
|
||||
List<string> files;
|
||||
bool success;
|
||||
var nodeObjectType = new Guid(Constants.ObjectTypes.Document);
|
||||
|
||||
foreach (var content in contents)
|
||||
using (var repository = _repositoryFactory.CreateRecycleBinRepository(_uowProvider.GetUnitOfWork()))
|
||||
{
|
||||
if (Deleting.IsRaisedEventCancelled(new DeleteEventArgs<IContent>(content), this))
|
||||
continue;
|
||||
ids = repository.GetIdsOfItemsInRecycleBin(nodeObjectType);
|
||||
files = repository.GetFilesInRecycleBin(nodeObjectType);
|
||||
|
||||
repository.Delete(content);
|
||||
if (EmptyingRecycleBin.IsRaisedEventCancelled(new RecycleBinEventArgs(nodeObjectType, ids, files), this))
|
||||
return;
|
||||
|
||||
Deleted.RaiseEvent(new DeleteEventArgs<IContent>(content, false), this);
|
||||
}*/
|
||||
repository.EmptyRecycleBin();
|
||||
uow.Commit();
|
||||
success = repository.EmptyRecycleBin(nodeObjectType);
|
||||
if (success)
|
||||
repository.DeleteFiles(files);
|
||||
}
|
||||
|
||||
EmptiedRecycleBin.RaiseEvent(new RecycleBinEventArgs(nodeObjectType, ids, files, success), this);
|
||||
}
|
||||
|
||||
Audit.Add(AuditTypes.Delete, "Empty Recycle Bin performed by user", 0, -20);
|
||||
Audit.Add(AuditTypes.Delete, "Empty Content Recycle Bin performed by user", 0, -20);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1903,7 +1904,7 @@ namespace Umbraco.Core.Services
|
||||
/// Occurs after Create
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that the Content object has been created, but not saved
|
||||
/// Please note that the Content object has been created, but might not have been saved
|
||||
/// so it does not have an identity yet (meaning no Id has been set).
|
||||
/// </remarks>
|
||||
public static event TypedEventHandler<IContentService, NewEventArgs<IContent>> Created;
|
||||
@@ -1957,6 +1958,16 @@ namespace Umbraco.Core.Services
|
||||
/// Occurs after Send to Publish
|
||||
/// </summary>
|
||||
public static event TypedEventHandler<IContentService, SendToPublishEventArgs<IContent>> SentToPublish;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs before the Recycle Bin is emptied
|
||||
/// </summary>
|
||||
public static event TypedEventHandler<IContentService, RecycleBinEventArgs> EmptyingRecycleBin;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs after the Recycle Bin has been Emptied
|
||||
/// </summary>
|
||||
public static event TypedEventHandler<IContentService, RecycleBinEventArgs> EmptiedRecycleBin;
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user