|
|
|
@ -7,7 +7,7 @@ using FLocal.Core; |
|
|
|
|
using FLocal.Common; |
|
|
|
|
|
|
|
|
|
namespace FLocal.IISHandler.handlers.request.maintenance { |
|
|
|
|
class CleanCacheHandler : AbstractNewMessageHandler { |
|
|
|
|
class CleanCacheHandler : AbstractPostHandler { |
|
|
|
|
|
|
|
|
|
protected override string templateName { |
|
|
|
|
get { |
|
|
|
@ -19,17 +19,15 @@ namespace FLocal.IISHandler.handlers.request.maintenance { |
|
|
|
|
if(context.account.user.name != Config.instance.AdminUserName) { |
|
|
|
|
throw new FLocalException("access denied"); |
|
|
|
|
} |
|
|
|
|
string table = context.httprequest.Form["table"].Trim(); |
|
|
|
|
int start = int.Parse(context.httprequest.Form["start"]); |
|
|
|
|
int length = int.Parse(context.httprequest.Form["length"]); |
|
|
|
|
ISqlObjectTableSpec tableSpec = TableManager.TABLES[table]; |
|
|
|
|
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 { |
|
|
|
|
if(tableSpec is IComplexSqlObjectTableSpec) { |
|
|
|
|
((IComplexSqlObjectTableSpec)tableSpec).refreshSqlObjectAndRelated(id); |
|
|
|
|
} else { |
|
|
|
|
tableSpec.refreshSqlObject(id); |
|
|
|
|
} |
|
|
|
|
refresher(id); |
|
|
|
|
} catch(NotFoundInDBException) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|