Commit 83a89838b2d4c8bbb4f0a97f9333dfcb976ae97e

Authored by Steven Glover
1 parent 3b87ba92b5
Exists in master

Changes resulting from review

1 1 This library adds a scheduled job that will empty your Alfresco trashcan according to configuration. The following properties can be configured in alfresco-global.properties:
2 2  
3 3 ```
4   -trashcan.cron=0 30 * * * ?
5   -trashcan.daysToKeep=P1D
6   -trashcan.deleteBatchCount=1000
  4 +# cron schedule for the Trashcan Cleaner job
  5 +# to disable, set it to something like trashcan-cleaner.cron=* * * * * ? 2099
  6 +trashcan-cleaner.cron=0 30 2 * * ?
  7 +
  8 +# the period for which trashcan items are kept (in java.time.Duration format)
  9 +# default is 1 month
  10 +trashcan-cleaner.keepPeriod=P1M
  11 +
  12 +# how many trashcan items to delete per job run
  13 +trashcan-cleaner.deleteBatchCount=1000
7 14 ```
8 15  
9 16 In the above configuration the scheduled process will clean all deleted items older than one day to a maximum of 1000 (each execution) each hour at the middle of the hour (30 minutes).
... ...
src/main/config/alfresco/module/alfresco-trashcan-cleaner/alfresco-global.properties
1   -# cron schedule for the Trashcan Cleaner job
2   -trashcan.cron=0 30 * * * ?
  1 +# cron schedule for the Trashcan Cleaner job. Run at At 2:30 am every day.
  2 +# to disable, set it to something like trashcan-cleaner.cron=* * * * * ? 2099
  3 +trashcan-cleaner.cron=0 30 2 * * ?
3 4  
4 5 # the period for which trashcan items are kept (in java.time.Duration format)
5   -trashcan.keepPeriod=P1D
  6 +# default is 1 month
  7 +trashcan-cleaner.keepPeriod=P1M
6 8  
7 9 # how many trashcan items to delete per job run
8   -trashcan.deleteBatchCount=1000
  10 +trashcan-cleaner.deleteBatchCount=1000
9 11 \ No newline at end of file
... ...
src/main/config/alfresco/module/alfresco-trashcan-cleaner/context/service-context.xml
... ... @@ -5,8 +5,8 @@
5 5 <bean id="trashcanCleaner" class="org.alfresco.trashcan.TrashcanCleaner">
6 6 <constructor-arg ref="nodeService" />
7 7 <constructor-arg ref="transactionService" />
8   - <constructor-arg value="${trashcan.deleteBatchCount}" />
9   - <constructor-arg value="${trashcan.keepPeriod}" />
  8 + <constructor-arg value="${trashcan-cleaner.deleteBatchCount}" />
  9 + <constructor-arg value="${trashcan-cleaner.keepPeriod}" />
10 10 </bean>
11 11  
12 12 <bean id="trashcanCleanerJob" class="org.alfresco.util.CronTriggerBean">
... ... @@ -25,7 +25,7 @@
25 25 </bean>
26 26 </property>
27 27 <property name="scheduler" ref="schedulerFactory" />
28   - <property name="cronExpression" value="${trashcan.cron}" />
  28 + <property name="cronExpression" value="${trashcan-cleaner.cron}" />
29 29 </bean>
30 30  
31 31 </beans>
... ...