File/program/themes/ruta/ruta_install.php

Description

/program/themes/ruta/ruta_install.php -- installer for the ruta theme

This file contains the ruta theme installer. The interface consists of these functions:

    ruta_install(&$messages,$theme_id) ruta_upgrade(&$messages,$theme_id) ruta_uninstall(&$messages,$theme_id) ruta_demodata(&$messages,$theme_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
ruta_demodata (line 423)

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.

    $config['language_key']   => install language code (eg. 'en') $config['dir']            => path to CMS Root Directory (eg. /home/httpd/htdocs) $config['www']            => URL of CMS Root Directory (eg. http://exemplum.eu) $config['progdir']        => path to program directory (eg. /home/httpd/htdocs/program) $config['progwww']        => URL of program directory (eg. http://exemplum.eu/program) $config['datadir']        => path to data directory (eg. /home/httpd/wasdata/a1b2c3d4e5f6) $config['title']          => the name of the site (as entered by Wilhelmina Bladergroen) $config['user_username']  => userid of webmaster (eg. wblader) $config['user_full_name'] => full name of webmaster (eg. Wilhelmina Bladergroen) $config['user_email']     => email of webmaster (eg. w.bladergroen@exemplum.eu) $config['user_id']        => numerical user_id (usually 1) $config['demo_salt']      => password salt for all demodata accounts $config['demo_password']  => password for all demodata accounts $config['demo_areas']     => array with demo area data $config['demo_groups']    => array with demo group data $config['demo_users']     => array with demo user data $config['demo_nodes']     => array with demo node data $config['demo_string']    => array with demo strings from /program/install/languages/LL/demodata.php $config['demo_replace']   => array with search/replace pairs to 'jazz up' the demo strings

With this information, we can add a demonstration configuration for the public area, which shows off the possibilities.

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

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.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool ruta_install (array &$messages, int $theme_id)
  • array &$messages: collects the (error) messages
  • int $theme_id: the key for this theme in the themes table
ruta_uninstall (line 371)

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.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool ruta_uninstall (array &$messages, int $theme_id)
  • array &$messages: collects the (error) messages
  • int $theme_id: the key for this theme in the themes table
ruta_upgrade (line 350)

upgrade the theme

this routine performs an upgrade to the installed theme. It does nothing (for now), but it must exist.

  • return: TRUE on success + output via $messages, FALSE otherwise
bool ruta_upgrade (array &$messages, int $theme_id)
  • array &$messages: collects the (error) messages
  • int $theme_id: the key for this theme in the themes table

Documentation generated on Tue, 28 Jun 2016 19:11:37 +0200 by phpDocumentor 1.4.0