2014-10-23 18:52:11 +10:00
|
|
|
using System;
|
|
|
|
|
using System.Web.Http;
|
2016-05-26 17:12:04 +02:00
|
|
|
using Umbraco.Web.PublishedCache;
|
|
|
|
|
using Umbraco.Web.PublishedCache.XmlPublishedCache;
|
2014-10-23 18:52:11 +10:00
|
|
|
using Umbraco.Web.WebApi;
|
2015-11-25 19:39:24 +01:00
|
|
|
using Umbraco.Web.WebApi.Filters;
|
2014-10-23 18:52:11 +10:00
|
|
|
|
|
|
|
|
namespace Umbraco.Web.WebServices
|
|
|
|
|
{
|
2015-11-25 19:39:24 +01:00
|
|
|
[ValidateAngularAntiForgeryToken]
|
2014-10-23 18:52:11 +10:00
|
|
|
public class XmlDataIntegrityController : UmbracoAuthorizedApiController
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
private readonly FacadeService _facadeService;
|
|
|
|
|
|
|
|
|
|
public XmlDataIntegrityController(IFacadeService facadeService)
|
|
|
|
|
{
|
2016-09-01 19:06:08 +02:00
|
|
|
if (facadeService == null) throw new ArgumentNullException(nameof(facadeService));
|
2016-05-26 17:12:04 +02:00
|
|
|
_facadeService = facadeService as FacadeService;
|
2016-09-01 19:06:08 +02:00
|
|
|
if (_facadeService == null) throw new NotSupportedException("Unsupported IFacadeService, only the Xml one is supported.");
|
2016-05-26 17:12:04 +02:00
|
|
|
}
|
|
|
|
|
|
2014-10-23 18:52:11 +10:00
|
|
|
[HttpPost]
|
|
|
|
|
public bool FixContentXmlTable()
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
_facadeService.RebuildContentAndPreviewXml();
|
|
|
|
|
return _facadeService.VerifyContentAndPreviewXml();
|
2014-10-23 18:52:11 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public bool FixMediaXmlTable()
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
_facadeService.RebuildMediaXml();
|
|
|
|
|
return _facadeService.VerifyMediaXml();
|
2014-10-23 18:52:11 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpPost]
|
|
|
|
|
public bool FixMembersXmlTable()
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
_facadeService.RebuildMemberXml();
|
|
|
|
|
return _facadeService.VerifyMemberXml();
|
2014-10-23 18:52:11 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public bool CheckContentXmlTable()
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
return _facadeService.VerifyContentAndPreviewXml();
|
2014-10-23 18:52:11 +10:00
|
|
|
}
|
2016-05-26 17:12:04 +02:00
|
|
|
|
2014-10-23 18:52:11 +10:00
|
|
|
[HttpGet]
|
|
|
|
|
public bool CheckMediaXmlTable()
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
return _facadeService.VerifyMediaXml();
|
2014-10-23 18:52:11 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[HttpGet]
|
|
|
|
|
public bool CheckMembersXmlTable()
|
|
|
|
|
{
|
2016-05-26 17:12:04 +02:00
|
|
|
return _facadeService.VerifyMemberXml();
|
2014-10-23 18:52:11 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|