[imp] expanding imp folder maintenance functions

brook davis brook at linuxbox.com
Mon Jul 25 12:37:22 PDT 2005


Hi all,

Ok, so I've decided to go with the Maintenance Tasks.  So far, I've been
unable to figure out exactly how these integrate into the system.  To
test, I've developed a dummy task and I've made the following steps:


1)
I've added:

imp/lib/Maintenance/Task/test_maintenance.php

this file contains a class definition:

class Maintenance_Task_test_maintenance extends Maintenance_Task {}

Inside the class are two dummy functions, doMaintenance() and
describeMaintenance().  The first simply returns true, the second
returns a descriptive string.

2)
I've added the following to the $maint_tasks array in
imp/lib/Maintenance/imp.php:

'test_maintenance'  => MAINTENANCE_MONTHLY

3)
I've added the following to imp/config/prefs.php:

$_prefs['test_maintenance'] = array(
    'value' => 0,
    'locked' => false,
    'shared' => false,
    'type' => 'checkbox',
    'desc' => _("Test Maintenance?"));


However, I'm still unable to get the UI class to print my form
elements.  Can anyone offer a suggestion on how I might be able to
accomplish this?  I've searched through the code, but I must be missing
something here.  What are the steps to integrate a task through the
Maintenance API?

All help greatly appreciated,

Brook Davis

>  
>
>>I'm going to be working on adding some user defined cron/login
>>maintenance tasks for user defined folders.  I'd like users to be able
>>to automatically delete messages in mailing list folders that are aged
>>over a selectable interval ( 1 week, 1 month, etc..).  This funtionality
>>will be defined on a per folder basis.  As far as I know, this
>>functionality only exists for the INBOX at present.  Ideally, I'd like
>>the users to not have to login for these actions to take effect, though
>>login triggering would be a good start.
>>    
>>
>
>If you are going to use the maintenance API, which I strongly suggest, 
>you *have* to be logged in for the maintenance tasks to run. But you 
>could create an external script, run as a crontab, that logs in as the 
>users and executes the tasks. This could be general enough to be used 
>for all maintenance tasks.
>  
>
>No reason for hooks. Just create new maintenance tasks in 
>imp/lib/Maintenance/Task/ or extend the existing ones where appropriate.
>
>
>  
>





More information about the imp mailing list