/program/themes/ruta/ruta_install.php -- installer for the ruta theme
This file contains the ruta theme installer. The interface consists of these functions:
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.
add demonstration data to the system
this routine adds demonstration data to the freshly installed system
Note If the theme is installed via the Install Wizard, this routine is called. However, if a theme is installed as an additional theme after installation, the {$theme}_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.
The array $config contains the following information.
With this information, we can add a demonstration configuration for the public area, which shows off the possibilities.
install the theme
perform the necessary actions to make this theme usable; add a handful of default values into the themes_properties table. Once a theme is actually used in an area, these defaults are copied from the themes_properties table to the themes_areas_properties table for the selected area. The user can subsequently edit these properties in the Area Manager.
uninstall the theme
this is a hook for future extensions of Website@School. For now we simply return success. Any real code could look like this:
DELETE FROM themes_areas_properties WHERE theme_id = $theme_id; DELETE FROM themes_properties WHERE theme_id = $theme_id; DELETE FROM themes WHERE theme_id = $theme_id;
or whatever.
upgrade the theme
this routine performs an upgrade to the installed theme. It does nothing (for now), but it must exist.
Documentation generated on Tue, 28 Jun 2016 19:11:37 +0200 by phpDocumentor 1.4.0