[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/Horde/ -> Maintenance.php (sommaire)

Do task yearly (First login after/on January 1).

Poids: 869 lignes (26 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 3 classes

Maintenance:: (17 méthodes):
  factory()
  Maintenance()
  runMaintenance()
  runMaintenancePage()
  infoMaintenance()
  exportIntervalPrefs()
  getPostData()
  getMaintenanceFormURL()
  _createTaskList()
  _loadModule()
  _getInitialPageURL()
  _getMaintenanceURL()
  _shutdown()
  _cacheTasklist()
  _retrieveTasklist()
  _doMaintenanceTasks()
  _needMaintenancePage()

Maintenance_Tasklist:: (10 méthodes):
  Maintenance_Tasklist()
  addTask()
  setNewPage()
  removeTask()
  inList()
  getList()
  getModule()
  getPostData()
  getTarget()
  processed()

Maintenance_Task:: (4 méthodes):
  Maintenance_Task()
  doMaintenance()
  describeMaintenance()
  getDisplayType()


Classe: Maintenance  - X-Ref

The Maintenance:: class provides a set of methods for dealing with
maintenance operations run upon login to Horde applications.

$Horde: framework/Maintenance/Maintenance.php,v 1.52.10.13 2006/01/01 21:28:26 jan Exp $

Copyright 2001-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>

See the enclosed file COPYING for license information (LGPL).  If you
did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

factory($module, $params = array()   X-Ref
Attempts to return a concrete Maintenance_* object based on the module
name passed into it.

param: string $module  The name of the Horde module.
param: array $params   A hash containing additional data needed by the
return: Maintenance  The Maintenance object, or false on error.

Maintenance($params = array()   X-Ref
Constructor.

param: array $params  A hash containing the following entries:

runMaintenance()   X-Ref
Do maintenance operations needed for this login.  This function
will generate the list of tasks to perform during this login
and will redirect to the maintenance page if necessary.  This
is the function that should be called from the application upon
login.


runMaintenancePage()   X-Ref
Do the necessary maintenance tasks for this loading of the maintenance
page.  This is the function that is called from the maintenance page
every time it is loaded.

return: integer  The display required for the maintenance page.

infoMaintenance($pref)   X-Ref
Returns the informational text message on what the operation is
about to do. Also indicates whether the box should be checked
by default or not. Operations that have been locked by the
admin will return null.

param: string $pref  Name of the operation to get information for.
return: array  1st element - Description of what the operation is about

exportIntervalPrefs()   X-Ref
Export variable names to use for creating select tables in the
preferences menu.

return: array  An array of variable names to be imported into the

getPostData()   X-Ref
Output hidden for elements for the POST form to ensure the calling
script has the same POST elements as when the maintenance operations
first run.

return: string  The form data.

getMaintenanceFormURL()   X-Ref
Return the URL needed for the maintenance form.

return: string  The URL to redirect to.

_createTaskList()   X-Ref
Creates the list of maintenance operations that are available
for this session (stored in a Maintenance_Tasklist object).

return: boolean  Returns true if list was created.

_loadModule($modname)   X-Ref
Load module (if not already loaded).

param: string $modname  Name of the module to load.
return: Maintenance_Task  A reference to the requested module.

_getInitialPageURL()   X-Ref
Get the URL for the initial page.

return: string  The URL for the initial page.

_getMaintenanceURL()   X-Ref
Get the URL for the maintenance page.

return: string  The URL for the maintenance page.

_shutdown()   X-Ref
Register the shutdown function for storing the maintenance
tasklist.


_cacheTasklist()   X-Ref
Cache the maintenance tasklist between page requests.


_retrieveTasklist()   X-Ref
Retrieves a cached maintenance tasklist or makes sure one is
created.


_doMaintenanceTasks()   X-Ref
Execute all confirmed tasks.


_needMaintenancePage()   X-Ref
Do any of the tasks require the maintenance page?

return: integer  The key of the task that requires the maintenance

Classe: Maintenance_Tasklist  - X-Ref

The Maintenance_Tasklist:: class is used to store the list of maintenance
tasks that need to be run during this login.

Copyright 2002-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>

See the enclosed file COPYING for license information (LGPL).  If you
did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Maintenance_Tasklist()   X-Ref
Constructor.


addTask($key, $confirmed, $display)   X-Ref
Adds a task to the tasklist.

param: string $key         The name of the task to perform.
param: boolean $confirmed  Has the task been confirmed?
param: integer $display    The display type of the task.

setNewPage($task, $flag)   X-Ref
Sets the newpage flag for a task.

param: string $task  The name of the task to alter.
param: string $flag  How to set the flag.

removeTask($task)   X-Ref
Removes the task from the tasklist.

param: string $task  The name of the task to alter.

inList($task)   X-Ref
Is this task already in the tasklist?

param: string $task  The name of the task.
return: boolean  Whether the task is already in the tasklist.

getList()   X-Ref
Return the list of tasks.

return: array  The list of tasks that still need to be done.

getModule()   X-Ref
Return the Horde module the tasks are running under.

return: string  The Horde module name.

getPostData()   X-Ref
Return the POST data.

return: array  The POST data from the initial URL.

getTarget()   X-Ref
Return the URL of the web page to load after maintenance is complete.

return: string  The target URL.

processed($set = false)   X-Ref
Sets/displays the flag to show that tasklist has been processed at
least once.

param: boolean $set  Set the flag?
return: boolean  Has the tasklist been processed before?

Classe: Maintenance_Task  - X-Ref

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-2006 Michael Slusarz <slusarz@bigworm.colorado.edu>

See the enclosed file COPYING for license information (LGPL).  If you
did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Maintenance_Task()   X-Ref
Constructor


doMaintenance()   X-Ref
Do maintenance operation (if it has been confirmed).

return: boolean  Whether the maintenance operation was successful or

describeMaintenance()   X-Ref
Return description information for the maintenance page.

return: string  Description that will be displayed on the maintenance

getDisplayType()   X-Ref
Returns the desired output type for the maintenance page.

return: integer  Desired output type for the maintenance confirmation



Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7