An alternative to UBB.threads
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

39 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Web.Core;
using FLocal.Common;
namespace FLocal.IISHandler.handlers.request.maintenance {
class CleanCacheHandler : AbstractPostHandler {
protected override string templateName {
get {
return "result/maintenance/CacheCleaned.xslt";
}
}
protected override XElement[] Do(WebContext context) {
if(context.account.user.name != Config.instance.AdminUserName) {
throw new FLocalException("access denied");
}
int start = int.Parse(context.httprequest.Form["start"]);
int length = int.Parse(context.httprequest.Form["length"]);
ISqlObjectTableSpec tableSpec = TableManager.TABLES[context.httprequest.Form["table"].Trim()];
Action<int> refresher = (tableSpec is IComplexSqlObjectTableSpec)
? ((IComplexSqlObjectTableSpec)tableSpec).refreshSqlObjectAndRelated
: (Action<int>)tableSpec.refreshSqlObject;
foreach(int id in Enumerable.Range(start, length)) {
try {
refresher(id);
} catch(NotFoundInDBException) {
}
}
return new XElement[] {
};
}
}
}