Class Maintenance_Task

Description

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)


	
			
Variable Summary
 integer $_display_type
Method Summary
 Maintenance_Task Maintenance_Task ()
 boolean doMaintenance ()
 integer getDisplayType ()
Variables
integer $_display_type = MAINTENANCE_OUTPUT_CONFIRM (line 810)

The style of the maintenance page output.

Possible values: MAINTENANCE_OUTPUT_CONFIRM, MAINTENANCE_OUTPUT_AGREE, MAINTENANCE_OUTPUT_NOTICE

Methods
Constructor Maintenance_Task (line 815)

Constructor

Maintenance_Task Maintenance_Task ()
describeMaintenance (line 836)

Return description information for the maintenance page.

  • return: Description that will be displayed on the maintenance confirmation page.
string describeMaintenance ()
doMaintenance (line 825)

Do maintenance operation (if it has been confirmed).

  • return: Whether the maintenance operation was successful or not.
boolean doMaintenance ()
getDisplayType (line 847)

Returns the desired output type for the maintenance page.

  • return: Desired output type for the maintenance confirmation page.
integer getDisplayType ()

Documentation generated on Sun, 30 Jan 2011 05:19:26 +0000 by phpDocumentor 1.4.3