mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
added on-demand database cleanup (date is hardcoded for the moment)
This commit is contained in:
@@ -24,6 +24,7 @@ import org.apache.wicket.protocol.http.servlet.ServletWebResponse;
|
||||
import org.apache.wicket.request.cycle.RequestCycle;
|
||||
import org.apache.wicket.util.crypt.Base64;
|
||||
|
||||
import com.commafeed.backend.DatabaseCleaner;
|
||||
import com.commafeed.backend.MetricsBean;
|
||||
import com.commafeed.backend.StartupBean;
|
||||
import com.commafeed.backend.dao.FeedCategoryDAO;
|
||||
@@ -124,6 +125,9 @@ public abstract class AbstractREST {
|
||||
@Inject
|
||||
FaviconFetcher faviconFetcher;
|
||||
|
||||
@Inject
|
||||
DatabaseCleaner cleaner;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
CommaFeedApplication app = CommaFeedApplication.get();
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.commafeed.frontend.rest.resources;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.ws.rs.DefaultValue;
|
||||
import javax.ws.rs.GET;
|
||||
@@ -189,4 +190,12 @@ public class AdminREST extends AbstractResourceREST {
|
||||
|
||||
return Response.ok(map).build();
|
||||
}
|
||||
|
||||
@Path("/cleanup")
|
||||
@GET
|
||||
public Response cleanup() {
|
||||
cleaner.cleanOlderThan(30, TimeUnit.DAYS);
|
||||
return Response.ok("ok").build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user