File/program/modules/mailpage/mailpage_install.php

Description

/program/modules/mailpage/mailpage_install.php - installer of the mailpage module

This file contains the mailpage module installer. The interface consists of these functions:

    mailpage_install(&$messages,$module_id) mailpage_upgrade(&$messages,$module_id) mailpage_uninstall(&$messages,$module_id) mailpage_demodata(&$messages,$module_id,&$config,$manifest)

These functions can be called from the main installer and/or admin.php.

Note You cannot be sure about the environment from which these routines are called. If the caller is the Install Wizard, you do not have all subroutines available. However, it IS possible to manipulate the database via the db_*() routines and/or the global $DB object. Therefore you have to keep the install routine extremly simple. You also have no option to interact with the user; the install has to be a silent install; you can only indicate success (TRUE) or failure (FALSE) and maybe an error message in $messages[] but that's it. Good luck.

Functions
mailpage_demodata (line 139)

add demonstration data to the system

this routine is a no-op because there is no mailpage demodata and if it is there, it is already created in the main demodata-routine in /program/install/demodata.php.

This routine is retained here as an example and also because a routine by this name should exist (even if it does nothing).

Note If the module is installed via the Install Wizard, this routine is called. However, if a module is installed as an additional module after installation, the {$mode}_demodata() routine is never called. This is because the only time you know that demodata is installed is when the Install Wizard runs. If we're called from admin.php, the webmaster may have already deleted existing (core) demodata so you never can be sure what to expect. To put it another way: it is hard to re-construct $config when we're NOT the Instal Wizard.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool mailpage_demodata (array &$messages, int $module_id, array &$config, array $manifest)
  • array &$messages: collects the (error) messages
  • int $module_id: the key for this module in the modules table
  • array &$config: pertinent data for the new website + demodata foundation
  • array $manifest: a copy from the manifest for this module
mailpage_install (line 61)

install the module

this routine installs the module. For this module there is nothing to install, so we simply return success.

Note that the record for this module is already created in the modules table; the pkey is $module_id.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool mailpage_install (array &$messages, int $module_id)
  • array &$messages: collects the (error) messages
  • int $module_id: the key for this module in the modules table
mailpage_uninstall (line 109)

uninstall the module

this is a hook for future extensions of Website@School. For now we simply return success.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool mailpage_uninstall (array &$messages, int $module_id)
  • array &$messages: collects the (error) messages
  • int $module_id: the key for this module in the modules table
mailpage_upgrade (line 77)

upgrade the module

this routine performs an upgrade to the installed module. This updates the list of submenu options in the module record. The submenu-feature was added 2014-05-05 and appears in release 0.90.6.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool mailpage_upgrade (array &$messages, int $module_id)
  • array &$messages: collects the (error) messages
  • int $module_id: the key for this module in the modules table

Documentation generated on Tue, 28 Jun 2016 19:10:16 +0200 by phpDocumentor 1.4.0