Abstract class to allow for modularization of specific maintenace tasks.
For this explanation, the specific Horde application you want to create maintenance actions for will be labeled HORDEAPP.
To add a new maintenance task, you need to do the following: [1] Add preference to "HORDEAPP/config/prefs.php" file. (The name of this preference will be referred to as PREFNAME) This preference should be of type 'checkbox' (i.e. 1 = on; 0 = off). [Optional:] Add a preference in prefs.php of the name 'PREFNAME_interval' to allow the user to set the interval. 'default' value should be set to the values of the interval constants above. If this preference doesn't exist, the default interval used will be the one that appears in $maint_tasks. [2] Create a directory named "HORDEAPP/lib/Maintenance". [3] Create a class entitled Maintenance_HORDEAPP that extends the Maintenance class. This class should contain only the application specific definitions of $maint_tasks (see above for description). Save this file as "HORDEAPP/lib/Maintenance/HORDEAPP.php". [4] Create a directory titled "HORDEAPP/lib/Maintenance/Task". [5] Create modules in HORDEAPP/lib/Maintenance/Task named 'PREFNAME.php' that extend the Maintenance_Task class. The class should be named Maintenance_Task_PREFNAME. The class should declare the following two methods: 'doMaintenance' - This is the function that is run to do the specified maintenance operation. 'describeMaintenance' - This function sets the preference text and text to be used on the confirmation page. Should return a description of what your 'doMaintenance' function is about to do. Neither function requires any parameters passed in.
There are 3 different types of maintenance (set via $_display_type): [1] MAINTENANCE_OUTPUT_CONFIRM Each output from describeMaintenance() will have a checkbox associated with it. For each checkbox selected, doMaintenance() for that task will be run. More than 1 confirmation message can be displayed on the maintenance page at once.
[2] MAINTENANCE_OUTPUT_AGREE The output from describeMaintenance() should be text asking the user to agree/disagree to specified terms. If 'yes' is selected, the POST variable 'agree' will be set. If 'no' is selected, the POST variable 'not_agree' will be set. In either case, doMaintenance() will ALWAYS be run. * This style will be displayed on its own, separate maintenance page. *
[3] MAINTENANCE_OUTPUT_NOTICE The output from describeMaintenance() should be any non-interactive text desired. There will be a single 'Click to Continue' button below this text. doMaintenance() will ALWAYS be run. * This style will be displayed on its own, separate maintenance page. *
Copyright 2001-2009 The Horde Project (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
Located in /Maintenance/Maintenance.php (line 800)
Constructor
Return description information for the maintenance page.
Do maintenance operation (if it has been confirmed).
Returns the desired output type for the maintenance page.
Documentation generated on Sun, 30 Jan 2011 05:19:26 +0000 by phpDocumentor 1.4.3